xl: create: close restore_fd_to_close on error

Currently the fd is opened and then later closed and
restore_fd_to_close set back to -1, however there are several goto out
and goto error_out paths in the interim.

Since the code resets restore_fd_to_close to -1 it is OK to check this
and close on the out path too.

CID: 1055897

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
Ian Campbell authored and Ian Jackson committed 2016-02-19 16:03:53 +00:00
1 parent b4aaf5a72f
commit 1a4c97d040
1 file changed
+7
+7
View File
@@ -3063,6 +3063,13 @@ error_out:
}
out:
if (restore_fd_to_close >= 0) {
if (close(restore_fd_to_close))
fprintf(stderr, "Failed to close restoring file, fd %d, errno %d\n",
restore_fd_to_close, errno);
restore_fd_to_close = -1;
}
if (logfile != 2)
close(logfile);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.