X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fsmack-util.c;h=a73a996cf6d5623608ecd25436cd0d286e31b35f;hb=e530ed5e1407e0571afc01552e41365ffb01befa;hp=b6c96435ce94a65918ca81adafd1760232726860;hpb=2ca620c4ed28c01f285d869d0b22f22a360957da;p=elogind.git diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c index b6c96435c..a73a996cf 100644 --- a/src/shared/smack-util.c +++ b/src/shared/smack-util.c @@ -125,8 +125,11 @@ int mac_smack_apply_ip_in_fd(int fd, const char *label) { } int mac_smack_apply_pid(pid_t pid, const char *label) { - int r = 0; + +#ifdef HAVE_SMACK const char *p; +#endif + int r = 0; assert(label); @@ -144,13 +147,15 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { } int mac_smack_fix(const char *path, bool ignore_enoent, bool ignore_erofs) { - int r = 0; #ifdef HAVE_SMACK struct stat st; +#endif + int r = 0; assert(path); +#ifdef HAVE_SMACK if (!mac_smack_use()) return 0; @@ -182,7 +187,7 @@ int mac_smack_fix(const char *path, bool ignore_enoent, bool ignore_erofs) { r = lsetxattr(path, "security.SMACK64", label, strlen(label), 0); /* If the FS doesn't support labels, then exit without warning */ - if (r < 0 && errno == ENOTSUP) + if (r < 0 && errno == EOPNOTSUPP) return 0; } @@ -194,8 +199,7 @@ int mac_smack_fix(const char *path, bool ignore_enoent, bool ignore_erofs) { if (ignore_erofs && errno == EROFS) return 0; - log_debug("Unable to fix SMACK label of %s: %m", path); - r = -errno; + r = log_debug_errno(errno, "Unable to fix SMACK label of %s: %m", path); } #endif