setup: joinpasswd.c - test return values
arekm
arekm at pld-linux.org
Sat Feb 21 19:26:20 CET 2009
Author: arekm Date: Sat Feb 21 18:26:20 2009 GMT
Module: setup Tag: HEAD
---- Log message:
- test return values
---- Files affected:
setup:
joinpasswd.c (1.9 -> 1.10)
---- Diffs:
================================================================
Index: setup/joinpasswd.c
diff -u setup/joinpasswd.c:1.9 setup/joinpasswd.c:1.10
--- setup/joinpasswd.c:1.9 Fri Sep 26 10:27:39 2003
+++ setup/joinpasswd.c Sat Feb 21 19:26:15 2009
@@ -102,7 +102,8 @@
fd = open(name, O_RDONLY);
if (fd == -1)
return NULL;
- fstat(fd, &st);
+ if (fstat(fd, &st) < 0)
+ return NULL;
*sz = st.st_size;
ptr = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if (ptr == MAP_FAILED)
@@ -282,6 +283,8 @@
#endif /* SILENT */
fd = open(old_name, O_WRONLY|O_APPEND);
+ if (fd < 0)
+ fatal("cannot open old file");
for (i = 0; i < new_sz; ) {
id = new + i;
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/setup/joinpasswd.c?r1=1.9&r2=1.10&f=u
More information about the pld-cvs-commit
mailing list