67 lines
2.5 KiB
Diff
67 lines
2.5 KiB
Diff
From: Simon McVittie <smcv@collabora.com>
|
|
Date: Mon, 16 Oct 2017 12:51:04 +0100
|
|
Subject: 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
|
|
Applied-upstream: 2017.13, commit:a4723dafed722008ed1ee3c952b7ff8e3d9b9a45
|
|
---
|
|
src/ostree/ot-builtin-create-usb.c | 2 +-
|
|
tests/libostreetest.c | 10 ++++++----
|
|
2 files changed, 7 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/ostree/ot-builtin-create-usb.c b/src/ostree/ot-builtin-create-usb.c
|
|
index c77dbcb..742a6c2 100644
|
|
--- a/src/ostree/ot-builtin-create-usb.c
|
|
+++ b/src/ostree/ot-builtin-create-usb.c
|
|
@@ -113,7 +113,7 @@ ostree_builtin_create_usb (int argc,
|
|
OstreeRepoMode mode = OSTREE_REPO_MODE_BARE_USER;
|
|
|
|
if (TEMP_FAILURE_RETRY (fgetxattr (mount_root_dfd, "user.test", NULL, 0)) < 0 &&
|
|
- errno == ENOTSUP)
|
|
+ (errno == ENOTSUP || errno == EOPNOTSUPP))
|
|
mode = OSTREE_REPO_MODE_ARCHIVE;
|
|
|
|
g_debug ("%s: Creating repository in mode %u", G_STRFUNC, mode);
|
|
diff --git a/tests/libostreetest.c b/tests/libostreetest.c
|
|
index 496ff74..11949c9 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;
|