From 0a24be213addfb32a8fdfc880fc2649f27d0b9ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Wed, 6 Aug 2014 14:15:15 +0300 Subject: [PATCH] make endmntent function handle null argument The function originates from SunOS 4.x in which the null argument is allowed. glibc also handles this case. --- src/misc/mntent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/misc/mntent.c b/src/misc/mntent.c index 3eafba5e..a16d6525 100644 --- a/src/misc/mntent.c +++ b/src/misc/mntent.c @@ -10,7 +10,7 @@ FILE *setmntent(const char *name, const char *mode) int endmntent(FILE *f) { - fclose(f); + if (f) fclose(f); return 1; }