tree-wide: Add error prefixing for most remaining syscalls
There were some important ones there like a random `syncfs()`. The remaining users are mostly blocked on the "fstatat enoent" case, I'll wait to port those. Closes: #1150 Approved by: jlebon
This commit is contained in:
parent
7afa966198
commit
c7d0be4fba
|
|
@ -1534,7 +1534,7 @@ ostree_repo_commit_transaction (OstreeRepo *self,
|
||||||
if (g_getenv ("OSTREE_SUPPRESS_SYNCFS") == NULL)
|
if (g_getenv ("OSTREE_SUPPRESS_SYNCFS") == NULL)
|
||||||
{
|
{
|
||||||
if (syncfs (self->tmp_dir_fd) < 0)
|
if (syncfs (self->tmp_dir_fd) < 0)
|
||||||
return glnx_throw_errno (error);
|
return glnx_throw_errno_prefix (error, "syncfs");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rename_pending_loose_objects (self, cancellable, error))
|
if (!rename_pending_loose_objects (self, cancellable, error))
|
||||||
|
|
@ -2798,8 +2798,8 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
|
||||||
OstreeRepoCommitFilterResult filter_result;
|
OstreeRepoCommitFilterResult filter_result;
|
||||||
struct stat dir_stbuf;
|
struct stat dir_stbuf;
|
||||||
|
|
||||||
if (fstat (src_dfd_iter->fd, &dir_stbuf) != 0)
|
if (!glnx_fstat (src_dfd_iter->fd, &dir_stbuf, error))
|
||||||
return glnx_throw_errno (error);
|
return FALSE;
|
||||||
|
|
||||||
child_info = _ostree_stbuf_to_gfileinfo (&dir_stbuf);
|
child_info = _ostree_stbuf_to_gfileinfo (&dir_stbuf);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1129,8 +1129,8 @@ impl_repo_remote_delete (OstreeRepo *self,
|
||||||
|
|
||||||
if (remote->file != NULL)
|
if (remote->file != NULL)
|
||||||
{
|
{
|
||||||
if (unlink (gs_file_get_path_cached (remote->file)) != 0)
|
if (!glnx_unlinkat (AT_FDCWD, gs_file_get_path_cached (remote->file), 0, error))
|
||||||
return glnx_throw_errno (error);
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -2362,8 +2362,8 @@ ostree_repo_open (OstreeRepo *self,
|
||||||
/* Note - we don't return this error yet! */
|
/* Note - we don't return this error yet! */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fstat (self->objects_dir_fd, &stbuf) != 0)
|
if (!glnx_fstat (self->objects_dir_fd, &stbuf, error))
|
||||||
return glnx_throw_errno (error);
|
return FALSE;
|
||||||
self->owner_uid = stbuf.st_uid;
|
self->owner_uid = stbuf.st_uid;
|
||||||
|
|
||||||
if (stbuf.st_uid != getuid () || stbuf.st_gid != getgid ())
|
if (stbuf.st_uid != getuid () || stbuf.st_gid != getgid ())
|
||||||
|
|
@ -2749,8 +2749,8 @@ load_metadata_internal (OstreeRepo *self,
|
||||||
|
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
{
|
{
|
||||||
if (fstat (fd, &stbuf) < 0)
|
if (!glnx_fstat (fd, &stbuf, error))
|
||||||
return glnx_throw_errno (error);
|
return FALSE;
|
||||||
|
|
||||||
if (out_variant)
|
if (out_variant)
|
||||||
{
|
{
|
||||||
|
|
@ -3173,7 +3173,7 @@ _ostree_repo_has_loose_object (OstreeRepo *self,
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
; /* Next dfd */
|
; /* Next dfd */
|
||||||
else
|
else
|
||||||
return glnx_throw_errno (error);
|
return glnx_throw_errno_prefix (error, "fstatat(%s)", loose_path_buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -3696,7 +3696,7 @@ ostree_repo_load_commit (OstreeRepo *self,
|
||||||
}
|
}
|
||||||
else if (errno != ENOENT)
|
else if (errno != ENOENT)
|
||||||
{
|
{
|
||||||
return glnx_throw_errno (error);
|
return glnx_throw_errno_prefix (error, "fstatat(%s)", commitpartial_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -521,7 +521,7 @@ ostree_sepolicy_get_label (OstreeSePolicy *self,
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
*out_label = NULL;
|
*out_label = NULL;
|
||||||
else
|
else
|
||||||
return glnx_throw_errno (error);
|
return glnx_throw_errno_prefix (error, "selabel_lookup");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -171,8 +171,8 @@ copy_dir_recurse (int src_parent_dfd,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Create with mode 0700, we'll fchmod/fchown later */
|
/* Create with mode 0700, we'll fchmod/fchown later */
|
||||||
if (mkdirat (dest_parent_dfd, name, 0700) != 0)
|
if (!glnx_ensure_dir (dest_parent_dfd, name, 0700, error))
|
||||||
return glnx_throw_errno (error);
|
return FALSE;
|
||||||
|
|
||||||
if (!glnx_opendirat (dest_parent_dfd, name, TRUE, &dest_dfd, error))
|
if (!glnx_opendirat (dest_parent_dfd, name, TRUE, &dest_dfd, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
||||||
|
|
@ -471,8 +471,8 @@ _ostree_sysroot_read_boot_loader_configs (OstreeSysroot *self,
|
||||||
if (dent == NULL)
|
if (dent == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (fstatat (dfd_iter.fd, dent->d_name, &stbuf, 0) != 0)
|
if (!glnx_fstatat (dfd_iter.fd, dent->d_name, &stbuf, 0, error))
|
||||||
return glnx_throw_errno (error);
|
return FALSE;
|
||||||
|
|
||||||
if (g_str_has_prefix (dent->d_name, "ostree-") &&
|
if (g_str_has_prefix (dent->d_name, "ostree-") &&
|
||||||
g_str_has_suffix (dent->d_name, ".conf") &&
|
g_str_has_suffix (dent->d_name, ".conf") &&
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue