mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
fish: edit: return 1 for unchanged file
Change the return value of edit_file_editor to 1, in case the editor did not change the (temporary) file.
This commit is contained in:
@@ -60,5 +60,5 @@ run_edit (const char *cmd, size_t argc, char *argv[])
|
||||
|
||||
r = edit_file_editor (g, remotefilename, editor, NULL);
|
||||
|
||||
return r;
|
||||
return r == -1 ? -1 : 0;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ edit_file_editor (guestfs_h *g, const char *filename, const char *editor,
|
||||
/* Changed? */
|
||||
if (oldstat.st_ctime == newstat.st_ctime &&
|
||||
oldstat.st_size == newstat.st_size)
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
/* Upload to a new file in the same directory, so if it fails we
|
||||
* don't end up with a partially written file. Give the new file
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
* If 'backup_extension' is not null, then a copy of 'filename' is saved
|
||||
* with 'backup_extension' appended to its file name.
|
||||
*
|
||||
* Returns -1 for failure, 0 otherwise.
|
||||
* Returns -1 for failure, 0 on success, 1 if the editor did not change
|
||||
* the file (e.g. the user closed the editor without saving).
|
||||
*/
|
||||
extern int edit_file_editor (guestfs_h *g, const char *filename,
|
||||
const char *editor, const char *backup_extension);
|
||||
|
||||
Reference in New Issue
Block a user