diff --git a/vfs/ChangeLog b/vfs/ChangeLog index ce818f0ce..0f975a8dc 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,7 @@ +2001-02-28 Pavel Machek + + * vfs.c (mc_def_ungetlocalcopy): Cleanup of error handling. + 2001-02-27 Pavel Machek * vfs.c (mc_ungetlocalcopy): Do not ignore errors. (Courtesy of diff --git a/vfs/vfs.c b/vfs/vfs.c index 9eb6b5c62..716ae5381 100644 --- a/vfs/vfs.c +++ b/vfs/vfs.c @@ -1120,8 +1120,11 @@ mc_def_ungetlocalcopy (vfs *vfs, char *filename, char *local, int has_changed) if (i == -1) goto failed; - if (close (fdin)==-1) + if (close (fdin)==-1) { + fdin = -1; goto failed; + } + fdin = -1; if (mc_close (fdout)==-1) { fdout = -1; goto failed; @@ -1133,8 +1136,8 @@ mc_def_ungetlocalcopy (vfs *vfs, char *filename, char *local, int has_changed) failed: message_1s (1, _("Changes to file lost"), filename); - if (fdout) mc_close(fdout); - if (fdin) close(fdin); + if (fdout!=-1) mc_close(fdout); + if (fdin!=-1) close(fdin); unlink (local); g_free (local); return -1;