]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/core/smack-setup.c
util-lib: split out allocation calls into alloc-util.[ch]
[thirdparty/systemd.git] / src / core / smack-setup.c
index cbe7d0b4a9c998b53eba4002aa2069c61078f3f4..0661ff9ecd5214f95010c21c3d73d4b6727e1fca 100644 (file)
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdio.h>
+#include <dirent.h>
 #include <errno.h>
-#include <string.h>
-#include <stdlib.h>
 #include <fcntl.h>
-#include <dirent.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
+#include "alloc-util.h"
+#include "dirent-util.h"
+#include "fd-util.h"
+#include "fileio.h"
+#include "log.h"
 #include "macro.h"
 #include "smack-setup.h"
+#include "string-util.h"
 #include "util.h"
-#include "fileio.h"
-#include "log.h"
 
 #ifdef HAVE_SMACK
 
@@ -215,16 +219,14 @@ int mac_smack_setup(bool *loaded_policy) {
                 log_info("Successfully loaded Smack policies.");
                 break;
         default:
-                log_warning("Failed to load Smack access rules: %s, ignoring.",
-                            strerror(abs(r)));
+                log_warning_errno(r, "Failed to load Smack access rules, ignoring: %m");
                 return 0;
         }
 
 #ifdef SMACK_RUN_LABEL
         r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
         if (r)
-                log_warning("Failed to set SMACK label \"%s\" on self: %s",
-                            SMACK_RUN_LABEL, strerror(-r));
+                log_warning_errno(r, "Failed to set SMACK label \"%s\" on self: %m", SMACK_RUN_LABEL);
 #endif
 
         r = write_cipso2_rules("/etc/smack/cipso.d/");
@@ -239,8 +241,7 @@ int mac_smack_setup(bool *loaded_policy) {
                 log_info("Successfully loaded Smack/CIPSO policies.");
                 break;
         default:
-                log_warning("Failed to load Smack/CIPSO access rules: %s, ignoring.",
-                            strerror(abs(r)));
+                log_warning_errno(r, "Failed to load Smack/CIPSO access rules, ignoring: %m");
                 return 0;
         }