libglnx porting: Use glnx_set_error_from_errno
⚠️ There is a notable spiked pit trap here around `posix_fallocate()` and `errno`. This has bit other projects, see e.g. https://github.com/systemd/systemd/commit/7bb87460e691d30c1a7fd23a1a8240776957e05f Otherwise the port was straightforward.
This commit is contained in:
1 parent
614483ecd1
commit
d456fe5adb
13 files changed
+88
-87
No files matched your search
@@ -112,17 +112,17 @@ dirfd_copy_attributes_and_xattrs (int src_parent_dfd,
|
||||
|
||||
if (fstat (src_dfd, &src_stbuf) != 0)
|
||||
{
|
||||
gs_set_error_from_errno (error, errno);
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
if (fchown (dest_dfd, src_stbuf.st_uid, src_stbuf.st_gid) != 0)
|
||||
{
|
||||
gs_set_error_from_errno (error, errno);
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
if (fchmod (dest_dfd, src_stbuf.st_mode) != 0)
|
||||
{
|
||||
gs_set_error_from_errno (error, errno);
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ copy_dir_recurse (int src_parent_dfd,
|
||||
/* Create with mode 0700, we'll fchmod/fchown later */
|
||||
if (mkdirat (dest_parent_dfd, name, 0700) != 0)
|
||||
{
|
||||
gs_set_error_from_errno (error, errno);
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ copy_dir_recurse (int src_parent_dfd,
|
||||
srcd = fdopendir (src_dfd);
|
||||
if (!srcd)
|
||||
{
|
||||
gs_set_error_from_errno (error, errno);
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ copy_dir_recurse (int src_parent_dfd,
|
||||
if (fstatat (src_dfd, name, &child_stbuf,
|
||||
AT_SYMLINK_NOFOLLOW) != 0)
|
||||
{
|
||||
gs_set_error_from_errno (error, errno);
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ ensure_directory_from_template (int orig_etc_fd,
|
||||
}
|
||||
else
|
||||
{
|
||||
gs_set_error_from_errno (error, errno);
|
||||
glnx_set_error_from_errno (error);
|
||||
g_prefix_error (error, "mkdirat: ");
|
||||
goto out;
|
||||
}
|
||||
@@ -312,7 +312,7 @@ copy_modified_config_file (int orig_etc_fd,
|
||||
|
||||
if (fstatat (modified_etc_fd, path, &modified_stbuf, AT_SYMLINK_NOFOLLOW) < 0)
|
||||
{
|
||||
gs_set_error_from_errno (error, errno);
|
||||
glnx_set_error_from_errno (error);
|
||||
g_prefix_error (error, "Failed to read modified config file '%s': ", path);
|
||||
goto out;
|
||||
}
|
||||
@@ -330,7 +330,7 @@ copy_modified_config_file (int orig_etc_fd,
|
||||
dest_parent_dfd = dup (new_etc_fd);
|
||||
if (dest_parent_dfd == -1)
|
||||
{
|
||||
gs_set_error_from_errno (error, errno);
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@@ -343,7 +343,7 @@ copy_modified_config_file (int orig_etc_fd,
|
||||
;
|
||||
else
|
||||
{
|
||||
gs_set_error_from_errno (error, errno);
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@@ -369,7 +369,7 @@ copy_modified_config_file (int orig_etc_fd,
|
||||
{
|
||||
if (unlinkat (new_etc_fd, path, 0) < 0)
|
||||
{
|
||||
gs_set_error_from_errno (error, errno);
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@@ -1367,7 +1367,7 @@ install_deployment_kernel (OstreeSysroot *sysroot,
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
{
|
||||
gs_set_error_from_errno (error, errno);
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user