]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/login/logind-user.c
Merge pull request #12420 from mrc0mmand/coccinelle-tweaks
[thirdparty/systemd.git] / src / login / logind-user.c
index ae27bfb6622fde83d28b90dde085796850cdf5f4..c5d442865cc39ec102c305cc463fe37d181db83e 100644 (file)
@@ -3,7 +3,6 @@
 #include <errno.h>
 #include <string.h>
 #include <unistd.h>
-#include <stdio_ext.h>
 
 #include "alloc-util.h"
 #include "bus-common-errors.h"
@@ -19,6 +18,7 @@
 #include "fs-util.h"
 #include "hashmap.h"
 #include "label.h"
+#include "limits-util.h"
 #include "logind-user.h"
 #include "mkdir.h"
 #include "parse-util.h"
@@ -68,6 +68,8 @@ int user_new(User **ret,
         if (!u->home)
                 return -ENOMEM;
 
+        path_simplify(u->home, true);
+
         if (asprintf(&u->state_file, "/run/systemd/users/"UID_FMT, uid) < 0)
                 return -ENOMEM;
 
@@ -159,7 +161,6 @@ static int user_save_internal(User *u) {
         if (r < 0)
                 goto fail;
 
-        (void) __fsetlocking(f, FSETLOCKING_BYCALLER);
         (void) fchmod(fileno(f), 0644);
 
         fprintf(f,
@@ -357,7 +358,8 @@ static void user_start_service(User *u) {
 
         r = manager_start_unit(u->manager, u->service, &error, &u->service_job);
         if (r < 0)
-                log_warning_errno(r, "Failed to start user service '%s', ignoring: %s", u->service, bus_error_message(&error, r));
+                log_full_errno(sd_bus_error_has_name(&error, BUS_ERROR_UNIT_MASKED) ? LOG_DEBUG : LOG_WARNING, r,
+                               "Failed to start user service '%s', ignoring: %s", u->service, bus_error_message(&error, r));
 }
 
 int user_start(User *u) {
@@ -367,7 +369,7 @@ int user_start(User *u) {
                 return 0;
 
         /* If u->stopping is set, the user is marked for removal and service stop-jobs are queued. We have to clear
-         * that flag before queing the start-jobs again. If they succeed, the user object can be re-used just fine
+         * that flag before queueing the start-jobs again. If they succeed, the user object can be re-used just fine
          * (pid1 takes care of job-ordering and proper restart), but if they fail, we want to force another user_stop()
          * so possibly pending units are stopped. */
         u->stopping = false;
@@ -752,7 +754,7 @@ void user_update_last_session_timer(User *u) {
 
         assert(!u->timer_event_source);
 
-        if (u->manager->user_stop_delay == 0 || u->manager->user_stop_delay == USEC_INFINITY)
+        if (IN_SET(u->manager->user_stop_delay, 0, USEC_INFINITY))
                 return;
 
         if (sd_event_get_state(u->manager->event) == SD_EVENT_FINISHED) {