]> granicus.if.org Git - shadow/commitdiff
* lib/commonio.c: Ignore teh return values of fclose() and
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 30 Apr 2009 21:53:54 +0000 (21:53 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 30 Apr 2009 21:53:54 +0000 (21:53 +0000)
unlink() in case of failure of fopen_set_perms() or
create_backup().
* lib/commonio.c: Should the backup file be unlink'ed in case of
failure of create_backup()?

ChangeLog
lib/commonio.c

index 4f4e40c481c2eb888bc40eb983a322c4765229e5..5fe6cbf0634bda024c3d68818dc60e8e7aef55ef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-04-30  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * lib/commonio.c: Ignore teh return values of fclose() and
+       unlink() in case of failure of fopen_set_perms() or
+       create_backup().
+       * lib/commonio.c: Should the backup file be unlink'ed in case of
+       failure of create_backup()?
+
 2009-04-30  Nicolas François  <nicolas.francois@centraliens.net>
 
        * lib/getulong.c: Added splint annotations.
index 455d3c0dcc6ba57ead5a043574f9183bc82853e8..c2394310927dd4ea8914aeadf590bfe71b25cbff 100644 (file)
@@ -222,8 +222,9 @@ static /*@null@*/ /*@dependent@*/FILE *fopen_set_perms (
        return fp;
 
       fail:
-       fclose (fp);
-       unlink (name);
+       (void) fclose (fp);
+       /* fopen_set_perms is used for intermediate files */
+       (void) unlink (name);
        return NULL;
 }
 
@@ -257,11 +258,13 @@ static int create_backup (const char *backup, FILE * fp)
                }
        }
        if ((c != EOF) || (ferror (fp) != 0) || (fflush (bkfp) != 0)) {
-               fclose (bkfp);
+               (void) fclose (bkfp);
+               /* FIXME: unlink the backup file? */
                return -1;
        }
        if (   (fsync (fileno (bkfp)) != 0)
            || (fclose (bkfp) != 0)) {
+               /* FIXME: unlink the backup file? */
                return -1;
        }