files: ignore errors when calling futimens() on a backup file
Access control lists can permit read and write access to a file but not permit to manipulate any attributes of the file. So it is quite possible for futimens() to fail, just like chown() and chmod() can fail, but this should be no cause for alarm: as long as writing the backup file worked, then writing the file itself will probably work too.master
parent
6d00e75dc2
commit
822d764d27
12
src/files.c
12
src/files.c
|
@ -1704,15 +1704,9 @@ bool write_file(const char *name, FILE *thefile, bool tmp,
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* And set the backup's timestamps. */
|
/* Set the backup's timestamps to those of the original file.
|
||||||
if (futimens(backup_fd, filetime) == -1 && !ISSET(INSECURE_BACKUP)) {
|
* Failure is unimportant: saving the file apparently worked. */
|
||||||
fclose(backup_file);
|
IGNORE_CALL_RESULT(futimens(backup_fd, filetime));
|
||||||
if (prompt_failed_backupwrite(backupname))
|
|
||||||
goto skip_backup;
|
|
||||||
statusline(HUSH, _("Error writing backup file %s: %s"),
|
|
||||||
backupname, strerror(errno));
|
|
||||||
goto cleanup_and_exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(backup_file);
|
fclose(backup_file);
|
||||||
free(backupname);
|
free(backupname);
|
||||||
|
|
Loading…
Reference in New Issue