diff options
author | Colin Walters <walters@verbum.org> | 2017-06-13 16:22:09 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2017-06-14 12:48:20 -0400 |
commit | 9a1b77ef96b4eb9a916a71e7a04055c4c5665dea (patch) | |
tree | c89856b6f755aae9b17167ed184d9d0ddc7b41df /glnx-fdio.c | |
parent | 05abf2143f967cd85b1b1b777ee412a581979cf1 (diff) | |
download | libglnx-9a1b77ef96b4eb9a916a71e7a04055c4c5665dea.tar.gz |
Add G_IN_SET, patch our internal users via spatch
I originally tried to get this into GLib:
https://bugzilla.gnome.org/show_bug.cgi?id=783751
But that looks like it's going to fail due to MSVC. Let's add it here at least
so I can start using it tomorrow and not wait for the MSVC team to catch up.
I renamed `glnx-alloca.h` to `glnx-macros.h` as a more natural collective
home for things from systemd's `macro.h`.
Finally, I used a Coccinelle spatch similar to the one referenced
in the above BZ to patch our uses.
Diffstat (limited to 'glnx-fdio.c')
-rw-r--r-- | glnx-fdio.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/glnx-fdio.c b/glnx-fdio.c index 87e2dbb..e496828 100644 --- a/glnx-fdio.c +++ b/glnx-fdio.c @@ -37,7 +37,6 @@ #include <glnx-fdio.h> #include <glnx-dirfd.h> -#include <glnx-alloca.h> #include <glnx-errors.h> #include <glnx-xattrs.h> #include <glnx-backport-autoptr.h> @@ -65,7 +64,7 @@ glnx_renameat2_noreplace (int olddirfd, const char *oldpath, #ifndef ENABLE_WRPSEUDO_COMPAT if (renameat2 (olddirfd, oldpath, newdirfd, newpath, RENAME_NOREPLACE) < 0) { - if (errno == EINVAL || errno == ENOSYS) + if (G_IN_SET(errno, EINVAL, ENOSYS)) { /* Fall through */ } @@ -119,7 +118,7 @@ glnx_renameat2_exchange (int olddirfd, const char *oldpath, return 0; else { - if (errno == ENOSYS || errno == EINVAL) + if (G_IN_SET(errno, ENOSYS, EINVAL)) { /* Fall through */ } @@ -195,7 +194,7 @@ glnx_open_tmpfile_linkable_at (int dfd, * in full. */ #if defined(O_TMPFILE) && !defined(DISABLE_OTMPFILE) && !defined(ENABLE_WRPSEUDO_COMPAT) fd = openat (dfd, subpath, O_TMPFILE|flags, 0600); - if (fd == -1 && !(errno == ENOSYS || errno == EISDIR || errno == EOPNOTSUPP)) + if (fd == -1 && !(G_IN_SET(errno, ENOSYS, EISDIR, EOPNOTSUPP))) return glnx_throw_errno_prefix (error, "open(O_TMPFILE)"); if (fd != -1) { |