Error handling of ungetlocalcopy was buggy. Fixed.

This commit is contained in:
Pavel Machek 2001-02-28 21:50:57 +00:00
parent 6ea4f905af
commit 7c997958f6
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2001-02-28 Pavel Machek <pavel@bug.ucw.cz>
* vfs.c (mc_def_ungetlocalcopy): Cleanup of error handling.
2001-02-27 Pavel Machek <pavel@bug.ucw.cz>
* vfs.c (mc_ungetlocalcopy): Do not ignore errors. (Courtesy of

View File

@ -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;