diff options
author | Colin Walters <walters@verbum.org> | 2017-07-19 09:40:23 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2017-07-19 11:35:09 -0400 |
commit | 268ae488167617b919b8bb219f555e1f9133e234 (patch) | |
tree | 8d5f8d4b4c47b9006175795e95546d8400a84e3a /tests | |
parent | 23f7df15006f14ddc3bc2ddee690f7f8604c3ebe (diff) | |
download | libglnx-268ae488167617b919b8bb219f555e1f9133e234.tar.gz |
fdio: Introduce glnx_openat_read()
This is kind of long overdue. Reasons are the same as the other wrappers. I
debated adding `O_NOFOLLOW` support but the use cases for that are pretty
obscure, callers who want that can just use the syscall directly for now.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-libglnx-xattrs.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/tests/test-libglnx-xattrs.c b/tests/test-libglnx-xattrs.c index b6f0ac6..37c982d 100644 --- a/tests/test-libglnx-xattrs.c +++ b/tests/test-libglnx-xattrs.c @@ -107,22 +107,17 @@ do_write_run (GLnxDirFdIterator *dfd_iter, GError **error) { while (TRUE) { - g_autoptr(GVariant) current_xattrs = NULL; - glnx_fd_close int fd = -1; - struct dirent *dent; if (!glnx_dirfd_iterator_next_dent (dfd_iter, &dent, NULL, error)) return FALSE; if (!dent) break; - fd = openat (dfd_iter->fd, dent->d_name, O_RDONLY | O_CLOEXEC); - if (fd < 0) - { - glnx_set_error_from_errno (error); - return FALSE; - } + glnx_fd_close int fd = -1; + if (!glnx_openat_rdonly (dfd_iter->fd, dent->d_name, FALSE, &fd, error)) + return FALSE; + g_autoptr(GVariant) current_xattrs = NULL; if (!glnx_fd_get_all_xattrs (fd, ¤t_xattrs, NULL, error)) return FALSE; @@ -156,22 +151,17 @@ do_read_run (GLnxDirFdIterator *dfd_iter, guint nattrs = 0; while (TRUE) { - g_autoptr(GVariant) current_xattrs = NULL; - glnx_fd_close int fd = -1; - struct dirent *dent; if (!glnx_dirfd_iterator_next_dent (dfd_iter, &dent, NULL, error)) return FALSE; if (!dent) break; - fd = openat (dfd_iter->fd, dent->d_name, O_RDONLY | O_CLOEXEC); - if (fd < 0) - { - glnx_set_error_from_errno (error); - return FALSE; - } + glnx_fd_close int fd = -1; + if (!glnx_openat_rdonly (dfd_iter->fd, dent->d_name, FALSE, &fd, error)) + return FALSE; + g_autoptr(GVariant) current_xattrs = NULL; if (!glnx_fd_get_all_xattrs (fd, ¤t_xattrs, NULL, error)) return FALSE; |