Port to libgsystem errno API, hard depend on 2014.3
This is long overdue to make it to libgsystem. Update our dependency.
This commit is contained in:
1 parent
1bcc7a8e3a
commit
1e8e070102
13 files changed
+71
-84
No files matched your search
@@ -43,7 +43,7 @@ ot_gopendirat (int dfd,
|
||||
int ret = ot_opendirat (dfd, path, follow);
|
||||
if (ret == -1)
|
||||
{
|
||||
ot_util_set_error_from_errno (error, errno);
|
||||
gs_set_error_from_errno (error, errno);
|
||||
return FALSE;
|
||||
}
|
||||
*out_fd = ret;
|
||||
@@ -69,7 +69,7 @@ ot_lgetxattrat (int dfd,
|
||||
while (G_UNLIKELY (bytes_read < 0 && errno == EINTR));
|
||||
if (G_UNLIKELY (bytes_read < 0))
|
||||
{
|
||||
ot_util_set_error_from_errno (error, errno);
|
||||
gs_set_error_from_errno (error, errno);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ ot_lgetxattrat (int dfd,
|
||||
while (G_UNLIKELY (real_size < 0 && errno == EINTR));
|
||||
if (G_UNLIKELY (real_size < 0))
|
||||
{
|
||||
ot_util_set_error_from_errno (error, errno);
|
||||
gs_set_error_from_errno (error, errno);
|
||||
g_free (buf);
|
||||
goto out;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ ot_lsetxattrat (int dfd,
|
||||
while (G_UNLIKELY (res == -1 && errno == EINTR));
|
||||
if (G_UNLIKELY (res == -1))
|
||||
{
|
||||
ot_util_set_error_from_errno (error, errno);
|
||||
gs_set_error_from_errno (error, errno);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -315,7 +315,7 @@ ot_gfile_replace_contents_fsync (GFile *path,
|
||||
int r = posix_fallocate (fd, 0, g_bytes_get_size (contents));
|
||||
if (r != 0)
|
||||
{
|
||||
ot_util_set_error_from_errno (error, r);
|
||||
gs_set_error_from_errno (error, r);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@@ -326,7 +326,7 @@ ot_gfile_replace_contents_fsync (GFile *path,
|
||||
|
||||
if (fdatasync (fd) != 0)
|
||||
{
|
||||
ot_util_set_error_from_errno (error, errno);
|
||||
gs_set_error_from_errno (error, errno);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ ot_gfile_replace_contents_fsync (GFile *path,
|
||||
|
||||
if (renameat (parent_dfd, tmpname, parent_dfd, target_basename) == -1)
|
||||
{
|
||||
ot_util_set_error_from_errno (error, errno);
|
||||
gs_set_error_from_errno (error, errno);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ ot_util_fsync_directory (GFile *dir,
|
||||
|
||||
if (fsync (dfd) != 0)
|
||||
{
|
||||
ot_util_set_error_from_errno (error, errno);
|
||||
gs_set_error_from_errno (error, errno);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ ot_gfile_atomic_symlink_swap (GFile *path,
|
||||
/* Ensure the link has hit disk */
|
||||
if (fsync (parent_dfd) != 0)
|
||||
{
|
||||
ot_util_set_error_from_errno (error, errno);
|
||||
gs_set_error_from_errno (error, errno);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ ot_gfile_atomic_symlink_swap (GFile *path,
|
||||
/* And sync again for good measure */
|
||||
if (fsync (parent_dfd) != 0)
|
||||
{
|
||||
ot_util_set_error_from_errno (error, errno);
|
||||
gs_set_error_from_errno (error, errno);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,17 +123,6 @@ ot_util_path_split_validate (const char *path,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
ot_util_set_error_from_errno (GError **error,
|
||||
gint saved_errno)
|
||||
{
|
||||
g_set_error_literal (error,
|
||||
G_IO_ERROR,
|
||||
g_io_error_from_errno (saved_errno),
|
||||
g_strerror (saved_errno));
|
||||
errno = saved_errno;
|
||||
}
|
||||
|
||||
void
|
||||
ot_util_fatal_literal (const char *msg)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,5 @@ gboolean ot_util_filename_validate (const char *name, GError **error);
|
||||
|
||||
gboolean ot_util_path_split_validate (const char *path, GPtrArray **out_components, GError **error);
|
||||
|
||||
void ot_util_set_error_from_errno (GError **error, gint saved_errno);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -188,7 +188,7 @@ ot_util_variant_map_fd (GFileDescriptorBased *stream,
|
||||
g_file_descriptor_based_get_fd (stream), start);
|
||||
if (!map)
|
||||
{
|
||||
ot_util_set_error_from_errno (error, errno);
|
||||
gs_set_error_from_errno (error, errno);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user