diff options
author | Colin Walters <walters@verbum.org> | 2013-01-04 19:46:02 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2013-01-04 19:46:02 -0500 |
commit | cd5fce713ca4056d8e1ef72004ca3c0035b7ad0c (patch) | |
tree | 736d4f97b82ac744dc59cc9194df3b3d0fb552c8 /src/libotutil/ot-unix-utils.c | |
parent | c9a840c65991c9d3a79d1b8e9648b62430fc29ff (diff) | |
download | ostree-cd5fce713ca4056d8e1ef72004ca3c0035b7ad0c.tar.gz |
core: Reuse more libgsystem API in utils
More code drain to libgsystem.
Diffstat (limited to 'src/libotutil/ot-unix-utils.c')
-rw-r--r-- | src/libotutil/ot-unix-utils.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/libotutil/ot-unix-utils.c b/src/libotutil/ot-unix-utils.c index d4793019..032b497a 100644 --- a/src/libotutil/ot-unix-utils.c +++ b/src/libotutil/ot-unix-utils.c @@ -189,49 +189,3 @@ ot_util_fatal_gerror (GError *error) g_assert (error != NULL); ot_util_fatal_literal (error->message); } - -/** - * ot_unix_close: - * - * Like close(), but uses #GError, and handles EINTR. - */ -gboolean -ot_unix_close (int fd, GError **error) -{ - int result; - do - result = close (fd); - while (G_UNLIKELY (result != 0 && errno == EINTR)); - if (result != 0) - { - ot_util_set_error_from_errno (error, errno); - return FALSE; - } - return TRUE; -} - -/** - * ot_unix_open_noatime: - * - * Open a file for reading, using O_NOATIME if possible. - */ -gboolean -ot_unix_open_noatime (const char *path, - int *out_fd, - GError **error) -{ - int fd; - -#ifdef O_NOATIME - fd = g_open (path, O_RDONLY | O_NOATIME | O_CLOEXEC, 0); - if (fd == -1 && errno == EPERM) -#endif - fd = g_open (path, O_RDONLY | O_CLOEXEC, 0); - if (fd == -1) - { - ot_util_set_error_from_errno (error, errno); - return FALSE; - } - *out_fd = fd; - return TRUE; -} |