Merge pull request #2211 from jlebon/pr/close-fd

lib/deploy: Don't leak fd when checksumming dtbs
This commit is contained in:
OpenShift Merge Robot authored and GitHub committed 2020-10-07 15:23:43 -04:00
commit 8eb2d5f820
1 file changed
+2 -2
+2 -2
View File
@@ -272,13 +272,13 @@ checksum_dir_recurse (int dfd,
} }
else else
{ {
int fd; glnx_autofd int fd = -1;
if (!ot_openat_ignore_enoent (dfditer.fd, d_name, &fd, error)) if (!ot_openat_ignore_enoent (dfditer.fd, d_name, &fd, error))
return FALSE; return FALSE;
if (fd != -1) if (fd != -1)
{ {
g_autoptr(GInputStream) in = g_unix_input_stream_new (fd, FALSE); g_autoptr(GInputStream) in = g_unix_input_stream_new (glnx_steal_fd (&fd), TRUE);
if (!ot_gio_splice_update_checksum (NULL, in, checksum, cancellable, error)) if (!ot_gio_splice_update_checksum (NULL, in, checksum, cancellable, error))
return FALSE; return FALSE;
} }