summaryrefslogtreecommitdiff
path: root/src/random-seed
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-10-10 11:06:56 +0200
committerLennart Poettering <lennart@poettering.net>2022-10-10 16:00:15 +0200
commit00675c363ffdb0144873ae24ce555556aedcab0d (patch)
treecb704aa245834efce4ec64d17870304b276a7dfc /src/random-seed
parentdcf1bf3b6dd934d3af629a1f9f24e083fce85255 (diff)
downloadsystemd-00675c363ffdb0144873ae24ce555556aedcab0d.tar.gz
tree-wide: add ERRNO_IS_XATTR_ABSENT() helper
We check the same list of error codes on various xattr operations, and we should on some more. Add a common helper for this purpose.
Diffstat (limited to 'src/random-seed')
-rw-r--r--src/random-seed/random-seed.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/random-seed/random-seed.c b/src/random-seed/random-seed.c
index dedbdb2667..82c29d0d7f 100644
--- a/src/random-seed/random-seed.c
+++ b/src/random-seed/random-seed.c
@@ -66,7 +66,7 @@ static CreditEntropy may_credit(int seed_fd) {
/* Determine if the file is marked as creditable */
r = fgetxattr_malloc(seed_fd, "user.random-seed-creditable", &creditable);
if (r < 0) {
- if (IN_SET(r, -ENODATA, -ENOSYS, -EOPNOTSUPP))
+ if (ERRNO_IS_XATTR_ABSENT(r))
log_debug_errno(r, "Seed file is not marked as creditable, not crediting.");
else
log_warning_errno(r, "Failed to read extended attribute, ignoring: %m");
@@ -235,7 +235,7 @@ static int run(int argc, char *argv[]) {
* it. */
if (fremovexattr(seed_fd, "user.random-seed-creditable") < 0) {
- if (!IN_SET(errno, ENODATA, ENOSYS, EOPNOTSUPP))
+ if (!ERRNO_IS_XATTR_ABSENT(errno))
log_warning_errno(errno, "Failed to remove extended attribute, ignoring: %m");
/* Otherwise, there was no creditable flag set, which is OK. */