ostree-repo.c: Fix file descriptor cleanup
0 was used as an "unset" flag for tmp_dir_fd, which is technically incorrect. For cache_dir_fd, -1 was used as the sentinal but 0 was checked for, resulting in close(-1). Closes: #507 Approved by: cgwalters
This commit is contained in:
parent
5893b68ef7
commit
a5af1cb688
|
|
@ -516,9 +516,9 @@ ostree_repo_finalize (GObject *object)
|
|||
g_free (self->commit_stagedir_name);
|
||||
glnx_release_lock_file (&self->commit_stagedir_lock);
|
||||
g_clear_object (&self->tmp_dir);
|
||||
if (self->tmp_dir_fd)
|
||||
if (self->tmp_dir_fd != -1)
|
||||
(void) close (self->tmp_dir_fd);
|
||||
if (self->cache_dir_fd)
|
||||
if (self->cache_dir_fd != -1)
|
||||
(void) close (self->cache_dir_fd);
|
||||
if (self->objects_dir_fd != -1)
|
||||
(void) close (self->objects_dir_fd);
|
||||
|
|
@ -702,6 +702,7 @@ ostree_repo_init (OstreeRepo *self)
|
|||
|
||||
self->repo_dir_fd = -1;
|
||||
self->cache_dir_fd = -1;
|
||||
self->tmp_dir_fd = -1;
|
||||
self->commit_stagedir_fd = -1;
|
||||
self->objects_dir_fd = -1;
|
||||
self->uncompressed_objects_dir_fd = -1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue