Преглед изворни кода

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.
Timo Teräs пре 10 година
родитељ
комит
0a24be213a
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      src/misc/mntent.c

+ 1 - 1
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;
 }