* src/vipw.c: Make sure opened files are closed.
This commit is contained in:
parent
401d72d609
commit
a6418fb0df
@ -1,3 +1,7 @@
|
||||
2009-05-25 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* src/vipw.c: Make sure opened files are closed.
|
||||
|
||||
2009-05-25 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* man/chpasswd.8.xml, man/grpck.8.xml, man/newgrp.1.xml,
|
||||
|
@ -116,8 +116,12 @@ static int create_backup_file (FILE * fp, const char *backup, struct stat *sb)
|
||||
unlink (backup);
|
||||
return -1;
|
||||
}
|
||||
if ( (fsync (fileno (bkfp)) != 0)
|
||||
|| (fclose (bkfp) != 0)) {
|
||||
if (fsync (fileno (bkfp)) != 0) {
|
||||
(void) fclose (bkfp);
|
||||
unlink (backup);
|
||||
return -1;
|
||||
}
|
||||
if (fclose (bkfp) != 0) {
|
||||
unlink (backup);
|
||||
return -1;
|
||||
}
|
||||
@ -225,6 +229,7 @@ vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
|
||||
if (create_backup_file (f, fileedit, &st1) != 0) {
|
||||
vipwexit (_("Couldn't make backup"), errno, 1);
|
||||
}
|
||||
(void) fclose (f);
|
||||
createedit = true;
|
||||
|
||||
editor = getenv ("VISUAL");
|
||||
|
Loading…
x
Reference in New Issue
Block a user