about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2014-08-06 14:15:15 +0300
committerRich Felker <dalias@aerifal.cx>2014-08-08 00:45:10 -0400
commit0a24be213addfb32a8fdfc880fc2649f27d0b9ce (patch)
tree79231817785af6f0da0b66a763e39eefc720482a
parent00733dd1cf791d13ff6155509cf139a5f7b2eecb (diff)
downloadmusl-0a24be213addfb32a8fdfc880fc2649f27d0b9ce.tar.gz
musl-0a24be213addfb32a8fdfc880fc2649f27d0b9ce.tar.xz
musl-0a24be213addfb32a8fdfc880fc2649f27d0b9ce.zip
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.
-rw-r--r--src/misc/mntent.c2
1 files changed, 1 insertions, 1 deletions
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;
 }