X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flogin%2Flogind-user.c;h=8a557df35be020d805f1450f1e7615239091dbf7;hp=0a0836afae85abac94e86d4c5a48fb98d2c0d31c;hb=ad0ff86c7c90c3d652edb7c81ebd3f07f70a9a07;hpb=1dc76d84ae35f23e10f37925df55bc66c61b0eaa diff --git a/src/login/logind-user.c b/src/login/logind-user.c index 0a0836afa..8a557df35 100644 --- a/src/login/logind-user.c +++ b/src/login/logind-user.c @@ -1,5 +1,3 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - /*** This file is part of systemd. @@ -328,17 +326,10 @@ int user_load(User *u) { if (s && s->display && display_is_local(s->display)) u->display = s; - if (realtime) { - unsigned long long l; - if (sscanf(realtime, "%llu", &l) > 0) - u->timestamp.realtime = l; - } - - if (monotonic) { - unsigned long long l; - if (sscanf(monotonic, "%llu", &l) > 0) - u->timestamp.monotonic = l; - } + if (realtime) + timestamp_deserialize(realtime, &u->timestamp.realtime); + if (monotonic) + timestamp_deserialize(monotonic, &u->timestamp.monotonic); return r; } @@ -399,7 +390,7 @@ fail: static int user_start_slice(User *u) { #if 0 /// elogind can not ask systemd via dbus to start user services - _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; + _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; const char *description; char *job; int r; @@ -418,13 +409,12 @@ static int user_start_slice(User *u) { u->manager->user_tasks_max, &error, &job); - if (r < 0) { + if (r >= 0) + u->slice_job = job; + else if (!sd_bus_error_has_name(&error, BUS_ERROR_UNIT_EXISTS)) /* we don't fail due to this, let's try to continue */ - if (!sd_bus_error_has_name(&error, BUS_ERROR_UNIT_EXISTS)) - log_error_errno(r, "Failed to start user slice %s, ignoring: %s (%s)", u->slice, bus_error_message(&error, r), error.name); - } else { - u->slice_job = job; - } + log_error_errno(r, "Failed to start user slice %s, ignoring: %s (%s)", + u->slice, bus_error_message(&error, r), error.name); #else assert(u); @@ -436,7 +426,7 @@ static int user_start_slice(User *u) { static int user_start_service(User *u) { #if 0 /// elogind can not ask systemd via dbus to start user services - _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; + _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; char *job; int r; @@ -527,7 +517,7 @@ int user_start(User *u) { #if 0 /// UNNEEDED by elogind static int user_stop_slice(User *u) { - _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; + _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; char *job; int r; @@ -546,7 +536,7 @@ static int user_stop_slice(User *u) { } static int user_stop_service(User *u) { - _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; + _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; char *job; int r; @@ -922,7 +912,7 @@ int config_parse_tmpfs_size( *sz = PAGE_ALIGN((size_t) ((physical_memory() * (uint64_t) ul) / (uint64_t) 100)); } else { - uint64_t k = 0; + uint64_t k; r = parse_size(rvalue, 1024, &k); if (r < 0 || (uint64_t) (size_t) k != k) {