chiark / gitweb /
treewide: yet more log_*_errno + return simplifications
[elogind.git] / src / login / logind-user.c
index 3847496c15cb5d574e56cb5cfe4a328ee4fed9c5..f865afdb53a3ddcb6be115aebd337e2d86171d90 100644 (file)
@@ -252,7 +252,7 @@ int user_save(User *u) {
 
 finish:
         if (r < 0)
-                log_error("Failed to save user data %s: %s", u->state_file, strerror(-r));
+                log_error_errno(r, "Failed to save user data %s: %m", u->state_file);
 
         return r;
 }
@@ -278,7 +278,7 @@ int user_load(User *u) {
                 if (r == -ENOENT)
                         return 0;
 
-                log_error("Failed to read %s: %s", u->state_file, strerror(-r));
+                log_error_errno(r, "Failed to read %s: %m", u->state_file);
                 return r;
         }
 
@@ -310,10 +310,8 @@ static int user_mkdir_runtime_path(User *u) {
         assert(u);
 
         r = mkdir_safe_label("/run/user", 0755, 0, 0);
-        if (r < 0) {
-                log_error("Failed to create /run/user: %s", strerror(-r));
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Failed to create /run/user: %m");
 
         if (!u->runtime_path) {
                 if (asprintf(&p, "/run/user/" UID_FMT, u->uid) < 0)
@@ -326,7 +324,7 @@ static int user_mkdir_runtime_path(User *u) {
 
                 mkdir(p, 0700);
 
-                if (use_smack())
+                if (mac_smack_use())
                         r = asprintf(&t, "mode=0700,smackfsroot=*,uid=" UID_FMT ",gid=" GID_FMT ",size=%zu", u->uid, u->gid, u->manager->runtime_dir_size);
                 else
                         r = asprintf(&t, "mode=0700,uid=" UID_FMT ",gid=" GID_FMT ",size=%zu", u->uid, u->gid, u->manager->runtime_dir_size);
@@ -338,7 +336,7 @@ static int user_mkdir_runtime_path(User *u) {
 
                 r = mount("tmpfs", p, "tmpfs", MS_NODEV|MS_NOSUID, t);
                 if (r < 0) {
-                        log_error("Failed to mount per-user tmpfs directory %s: %s", p, strerror(-r));
+                        log_error_errno(r, "Failed to mount per-user tmpfs directory %s: %m", p);
                         goto fail;
                 }
         }
@@ -510,14 +508,14 @@ static int user_remove_runtime_path(User *u) {
 
         r = rm_rf(u->runtime_path, false, false, false);
         if (r < 0)
-                log_error("Failed to remove runtime directory %s: %s", u->runtime_path, strerror(-r));
+                log_error_errno(r, "Failed to remove runtime directory %s: %m", u->runtime_path);
 
         if (umount2(u->runtime_path, MNT_DETACH) < 0)
                 log_error("Failed to unmount user runtime directory %s: %m", u->runtime_path);
 
         r = rm_rf(u->runtime_path, false, true, false);
         if (r < 0)
-                log_error("Failed to remove runtime directory %s: %s", u->runtime_path, strerror(-r));
+                log_error_errno(r, "Failed to remove runtime directory %s: %m", u->runtime_path);
 
         free(u->runtime_path);
         u->runtime_path = NULL;