From: Tobias Stoeckmann Date: Sun, 11 Jan 2026 22:18:48 +0000 (+0100) Subject: lib/commonio.c: Unlink backup file on error X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4720918690c79aa31a7fb26d393cc4e747648d1;p=thirdparty%2Fshadow.git lib/commonio.c: Unlink backup file on error It doesn't make sense to keep a file around if it's not even a proper backup. Signed-off-by: Tobias Stoeckmann --- diff --git a/lib/commonio.c b/lib/commonio.c index 2f278df26..846372b12 100644 --- a/lib/commonio.c +++ b/lib/commonio.c @@ -299,16 +299,16 @@ static int create_backup (const char *backup, FILE * fp) } if ((c != EOF) || (ferror (fp) != 0) || (fflush (bkfp) != 0)) { (void) fclose (bkfp); - /* FIXME: unlink the backup file? */ + unlink(backup); return -1; } if (fsync (fileno (bkfp)) != 0) { (void) fclose (bkfp); - /* FIXME: unlink the backup file? */ + unlink(backup); return -1; } if (fclose (bkfp) != 0) { - /* FIXME: unlink the backup file? */ + unlink(backup); return -1; }