From f7c9ade22fcd0156fb76a3e1dbdac76883f43472 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 23 Sep 2021 17:08:58 +0200 Subject: [PATCH] smack-util: tiny simplification --- src/shared/smack-util.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c index 01958f0b0d9..1d040200278 100644 --- a/src/shared/smack-util.c +++ b/src/shared/smack-util.c @@ -286,14 +286,13 @@ int mac_smack_copy(const char *dest, const char *src) { #endif int rename_and_apply_smack_floor_label(const char *from, const char *to) { - int r = 0; + if (rename(from, to) < 0) return -errno; #if HAVE_SMACK_RUN_LABEL - r = mac_smack_apply(to, SMACK_ATTR_ACCESS, SMACK_FLOOR_LABEL); - if (r < 0) - return r; + return mac_smack_apply(to, SMACK_ATTR_ACCESS, SMACK_FLOOR_LABEL); +#else + return 0; #endif - return r; }