tree-wide: Update to new libglnx fd APIs
This ends up a lot better IMO. This commit is *mostly* just
`s/glnx_close_fd/glnx_autofd`, but there's also a number of hunks like:
```
- if (self->sysroot_fd != -1)
- {
- (void) close (self->sysroot_fd);
- self->sysroot_fd = -1;
- }
+ glnx_close_fd (&self->sysroot_fd);
```
Update submodule: libglnx
Closes: #1259
Approved by: jlebon
This commit is contained in:
1 parent
3e3d28632d
commit
1825f03fe7
29 files changed
+116
-137
No files matched your search
@@ -224,7 +224,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo *self,
|
||||
const char *dir_or_file_path = gs_file_get_path_cached (dir_or_file);
|
||||
|
||||
/* First, try opening it as a directory */
|
||||
glnx_fd_close int dfd = glnx_opendirat_with_errno (AT_FDCWD, dir_or_file_path, TRUE);
|
||||
glnx_autofd int dfd = glnx_opendirat_with_errno (AT_FDCWD, dir_or_file_path, TRUE);
|
||||
if (dfd < 0)
|
||||
{
|
||||
if (errno != ENOTDIR)
|
||||
@@ -241,7 +241,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo *self,
|
||||
else
|
||||
basename = g_strdup ("superblock");
|
||||
|
||||
glnx_fd_close int meta_fd = openat (dfd, basename, O_RDONLY | O_CLOEXEC);
|
||||
glnx_autofd int meta_fd = openat (dfd, basename, O_RDONLY | O_CLOEXEC);
|
||||
if (meta_fd < 0)
|
||||
return glnx_throw_errno_prefix (error, "openat(%s)", basename);
|
||||
|
||||
@@ -377,7 +377,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo *self,
|
||||
else
|
||||
{
|
||||
g_autofree char *relpath = g_strdup_printf ("%u", i); /* TODO avoid malloc here */
|
||||
glnx_fd_close int part_fd = openat (dfd, relpath, O_RDONLY | O_CLOEXEC);
|
||||
glnx_autofd int part_fd = openat (dfd, relpath, O_RDONLY | O_CLOEXEC);
|
||||
if (part_fd < 0)
|
||||
return glnx_throw_errno_prefix (error, "Opening deltapart '%s'", relpath);
|
||||
|
||||
@@ -525,7 +525,7 @@ show_one_part (OstreeRepo *self,
|
||||
g_print ("PartMeta%u: nobjects=%u size=%" G_GUINT64_FORMAT " usize=%" G_GUINT64_FORMAT "\n",
|
||||
i, (guint)(g_variant_get_size (objects) / OSTREE_STATIC_DELTA_OBJTYPE_CSUM_LEN), size, usize);
|
||||
|
||||
glnx_fd_close gint part_fd = openat (self->repo_dir_fd, part_path, O_RDONLY | O_CLOEXEC);
|
||||
glnx_autofd int part_fd = openat (self->repo_dir_fd, part_path, O_RDONLY | O_CLOEXEC);
|
||||
if (part_fd < 0)
|
||||
return glnx_throw_errno_prefix (error, "openat(%s)", part_path);
|
||||
g_autoptr(GInputStream) part_in = g_unix_input_stream_new (part_fd, FALSE);
|
||||
@@ -767,7 +767,7 @@ _ostree_repo_static_delta_dump (OstreeRepo *self,
|
||||
|
||||
superblock_path = _ostree_get_relative_static_delta_superblock_path (from, to);
|
||||
|
||||
glnx_fd_close int superblock_fd = -1;
|
||||
glnx_autofd int superblock_fd = -1;
|
||||
if (!glnx_openat_rdonly (self->repo_dir_fd, superblock_path, TRUE, &superblock_fd, error))
|
||||
return FALSE;
|
||||
if (!ot_variant_read_fd (superblock_fd, 0,
|
||||
|
||||
Reference in new issue
Block a user