diff options
author | Simon McVittie <smcv@collabora.com> | 2017-10-16 12:51:04 +0100 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-10-16 13:08:06 +0000 |
commit | a4723dafed722008ed1ee3c952b7ff8e3d9b9a45 (patch) | |
tree | 308b8fb39b45f3f638b58be4f1c822d6352b9531 /tests/libostreetest.c | |
parent | 950318936286b1b1ffcc2894a846af447e8dab12 (diff) | |
download | ostree-a4723dafed722008ed1ee3c952b7ff8e3d9b9a45.tar.gz |
Cope with xattr syscalls raising EOPNOTSUPP
ENOTSUP and EOPNOTSUPP are numerically equal on most Linux ports,
but inexplicably differ on PA-RISC (hppa) and possibly other
rare architectures.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Closes: #1275
Approved by: cgwalters
Diffstat (limited to 'tests/libostreetest.c')
-rw-r--r-- | tests/libostreetest.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/libostreetest.c b/tests/libostreetest.c index 496ff740..11949c98 100644 --- a/tests/libostreetest.c +++ b/tests/libostreetest.c @@ -85,8 +85,10 @@ ot_check_relabeling (gboolean *can_relabel, g_autoptr(GBytes) bytes = glnx_fgetxattr_bytes (tmpf.fd, "security.selinux", &local_error); if (!bytes) { - /* libglnx preserves errno */ - if (G_IN_SET (errno, ENOTSUP, ENODATA)) + /* libglnx preserves errno. The EOPNOTSUPP case can't be part of a + * 'case' statement because on most but not all architectures, + * it's numerically equal to ENOTSUP. */ + if (G_IN_SET (errno, ENOTSUP, ENODATA) || errno == EOPNOTSUPP) { *can_relabel = FALSE; return TRUE; @@ -99,7 +101,7 @@ ot_check_relabeling (gboolean *can_relabel, const guint8 *data = g_bytes_get_data (bytes, &data_len); if (fsetxattr (tmpf.fd, "security.selinux", data, data_len, 0) < 0) { - if (errno == ENOTSUP) + if (errno == ENOTSUP || errno == EOPNOTSUPP) { *can_relabel = FALSE; return TRUE; @@ -122,7 +124,7 @@ ot_check_user_xattrs (gboolean *has_user_xattrs, if (fsetxattr (tmpf.fd, "user.test", "novalue", strlen ("novalue"), 0) < 0) { - if (errno == ENOTSUP) + if (errno == ENOTSUP || errno == EOPNOTSUPP) { *has_user_xattrs = FALSE; return TRUE; |