summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-04-25 07:45:15 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-05-15 15:29:58 +0200
commitde0671ee7fe465e108f62dcbbbe9366f81dd9e9a (patch)
tree3ee30af44852655c365104703359b47a6e6219b5 /src/login
parent12ed81d9c88406234c20e9261ae8c8b992d8bc4d (diff)
Remove unnecessary casts in printfs
No functional change expected :)
Diffstat (limited to 'src/login')
-rw-r--r--src/login/inhibit.c4
-rw-r--r--src/login/logind-action.c12
-rw-r--r--src/login/logind-dbus.c18
-rw-r--r--src/login/logind-inhibit.c8
-rw-r--r--src/login/logind-session.c4
-rw-r--r--src/login/logind-user-dbus.c2
-rw-r--r--src/login/logind-user.c10
-rw-r--r--src/login/logind.c4
-rw-r--r--src/login/pam-module.c4
-rw-r--r--src/login/test-inhibit.c4
10 files changed, 35 insertions, 35 deletions
diff --git a/src/login/inhibit.c b/src/login/inhibit.c
index ae3afdf9b7..24e8fb04bd 100644
--- a/src/login/inhibit.c
+++ b/src/login/inhibit.c
@@ -100,11 +100,11 @@ static int print_inhibitors(sd_bus *bus, sd_bus_error *error) {
get_process_comm(pid, &comm);
u = uid_to_name(uid);
- printf(" Who: %s (UID %lu/%s, PID %lu/%s)\n"
+ printf(" Who: %s (UID "UID_FMT"/%s, PID "PID_FMT"/%s)\n"
" What: %s\n"
" Why: %s\n"
" Mode: %s\n\n",
- who, (unsigned long) uid, strna(u), (unsigned long) pid, strna(comm),
+ who, uid, strna(u), pid, strna(comm),
what,
why,
mode);
diff --git a/src/login/logind-action.c b/src/login/logind-action.c
index 1928f43cd1..ae9cd4894a 100644
--- a/src/login/logind-action.c
+++ b/src/login/logind-action.c
@@ -153,17 +153,17 @@ int manager_handle_action(
/* If this is just a recheck of the lid switch then don't warn about anything */
if (!is_edge) {
- log_debug("Refusing operation, %s is inhibited by UID %lu/%s, PID %lu/%s.",
+ log_debug("Refusing operation, %s is inhibited by UID "UID_FMT"/%s, PID "PID_FMT"/%s.",
inhibit_what_to_string(inhibit_operation),
- (unsigned long) offending->uid, strna(u),
- (unsigned long) offending->pid, strna(comm));
+ offending->uid, strna(u),
+ offending->pid, strna(comm));
return 0;
}
- log_error("Refusing operation, %s is inhibited by UID %lu/%s, PID %lu/%s.",
+ log_error("Refusing operation, %s is inhibited by UID "UID_FMT"/%s, PID "PID_FMT"/%s.",
inhibit_what_to_string(inhibit_operation),
- (unsigned long) offending->uid, strna(u),
- (unsigned long) offending->pid, strna(comm));
+ offending->uid, strna(u),
+ offending->pid, strna(comm));
warn_melody();
return -EPERM;
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 0af67148af..1a363c2c59 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -189,7 +189,7 @@ static int method_get_session_by_pid(sd_bus *bus, sd_bus_message *message, void
if (r < 0)
return r;
if (!session)
- return sd_bus_error_setf(error, BUS_ERROR_NO_SESSION_FOR_PID, "PID %lu does not belong to any known session", (unsigned long) pid);
+ return sd_bus_error_setf(error, BUS_ERROR_NO_SESSION_FOR_PID, "PID "PID_FMT" does not belong to any known session", pid);
p = session_bus_path(session);
if (!p)
@@ -215,7 +215,7 @@ static int method_get_user(sd_bus *bus, sd_bus_message *message, void *userdata,
user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
if (!user)
- return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user '%lu' known or logged in", (unsigned long) uid);
+ return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user "UID_FMT" known or logged in", uid);
p = user_bus_path(user);
if (!p)
@@ -257,7 +257,7 @@ static int method_get_user_by_pid(sd_bus *bus, sd_bus_message *message, void *us
if (r < 0)
return r;
if (!user)
- return sd_bus_error_setf(error, BUS_ERROR_NO_USER_FOR_PID, "PID %lu does not belong to any known or logged in user", (unsigned long) pid);
+ return sd_bus_error_setf(error, BUS_ERROR_NO_USER_FOR_PID, "PID "PID_FMT" does not belong to any known or logged in user", pid);
p = user_bus_path(user);
if (!p)
@@ -621,7 +621,7 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
if (audit_id > 0) {
/* Keep our session IDs and the audit session IDs in sync */
- if (asprintf(&id, "%lu", (unsigned long) audit_id) < 0)
+ if (asprintf(&id, "%"PRIu32, audit_id) < 0)
return -ENOMEM;
/* Wut? There's already a session by this name and we
@@ -923,7 +923,7 @@ static int method_kill_user(sd_bus *bus, sd_bus_message *message, void *userdata
user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
if (!user)
- return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user '%lu' known or logged in", (unsigned long) uid);
+ return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user "UID_FMT" known or logged in", uid);
r = user_kill(user, signo);
if (r < 0)
@@ -973,7 +973,7 @@ static int method_terminate_user(sd_bus *bus, sd_bus_message *message, void *use
user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
if (!user)
- return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user '%lu' known or logged in", (unsigned long) uid);
+ return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user "UID_FMT" known or logged in", uid);
r = user_stop(user, true);
if (r < 0)
@@ -2220,9 +2220,9 @@ int manager_dispatch_delayed(Manager *manager) {
if (manager->action_timestamp + manager->inhibit_delay_max > now(CLOCK_MONOTONIC))
return 0;
- log_info("Delay lock is active (UID %lu/%s, PID %lu/%s) but inhibitor timeout is reached.",
- (unsigned long) offending->uid, strna(u),
- (unsigned long) offending->pid, strna(comm));
+ log_info("Delay lock is active (UID "UID_FMT"/%s, PID "PID_FMT"/%s) but inhibitor timeout is reached.",
+ offending->uid, strna(u),
+ offending->pid, strna(comm));
}
/* Actually do the operation */
diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
index 8b329abd79..64a62ffeae 100644
--- a/src/login/logind-inhibit.c
+++ b/src/login/logind-inhibit.c
@@ -151,9 +151,9 @@ int inhibitor_start(Inhibitor *i) {
dual_timestamp_get(&i->since);
- log_debug("Inhibitor %s (%s) pid=%lu uid=%lu mode=%s started.",
+ log_debug("Inhibitor %s (%s) pid="PID_FMT" uid="UID_FMT" mode=%s started.",
strna(i->who), strna(i->why),
- (unsigned long) i->pid, (unsigned long) i->uid,
+ i->pid, i->uid,
inhibit_mode_to_string(i->mode));
inhibitor_save(i);
@@ -169,9 +169,9 @@ int inhibitor_stop(Inhibitor *i) {
assert(i);
if (i->started)
- log_debug("Inhibitor %s (%s) pid=%lu uid=%lu mode=%s stopped.",
+ log_debug("Inhibitor %s (%s) pid="PID_FMT" uid="UID_FMT" mode=%s stopped.",
strna(i->who), strna(i->why),
- (unsigned long) i->pid, (unsigned long) i->uid,
+ i->pid, i->uid,
inhibit_mode_to_string(i->mode));
if (i->state_file)
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 8e6f95e6cd..4fb229e354 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -533,7 +533,7 @@ int session_start(Session *s) {
MESSAGE_ID(SD_MESSAGE_SESSION_START),
"SESSION_ID=%s", s->id,
"USER_ID=%s", s->user->name,
- "LEADER=%lu", (unsigned long) s->leader,
+ "LEADER="PID_FMT, s->leader,
"MESSAGE=New session %s of user %s.", s->id, s->user->name,
NULL);
@@ -632,7 +632,7 @@ int session_finalize(Session *s) {
MESSAGE_ID(SD_MESSAGE_SESSION_STOP),
"SESSION_ID=%s", s->id,
"USER_ID=%s", s->user->name,
- "LEADER=%lu", (unsigned long) s->leader,
+ "LEADER="PID_FMT, s->leader,
"MESSAGE=Removed session %s.", s->id,
NULL);
diff --git a/src/login/logind-user-dbus.c b/src/login/logind-user-dbus.c
index 4f1a079ecd..6266ccb0f0 100644
--- a/src/login/logind-user-dbus.c
+++ b/src/login/logind-user-dbus.c
@@ -291,7 +291,7 @@ char *user_bus_path(User *u) {
assert(u);
- if (asprintf(&s, "/org/freedesktop/login1/user/_%llu", (unsigned long long) u->uid) < 0)
+ if (asprintf(&s, "/org/freedesktop/login1/user/_"UID_FMT, u->uid) < 0)
return NULL;
return s;
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index 961cbcb27b..5fffa651a3 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -52,7 +52,7 @@ User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name) {
if (!u->name)
goto fail;
- if (asprintf(&u->state_file, "/run/systemd/users/%lu", (unsigned long) uid) < 0)
+ if (asprintf(&u->state_file, "/run/systemd/users/"UID_FMT, uid) < 0)
goto fail;
if (hashmap_put(m->users, ULONG_TO_PTR((unsigned long) uid), u) < 0)
@@ -354,8 +354,8 @@ static int user_start_slice(User *u) {
if (!u->slice) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- char lu[DECIMAL_STR_MAX(unsigned long) + 1], *slice;
- sprintf(lu, "%lu", (unsigned long) u->uid);
+ char lu[DECIMAL_STR_MAX(uid_t) + 1], *slice;
+ sprintf(lu, UID_FMT, u->uid);
r = build_subslice(SPECIAL_USER_SLICE, lu, &slice);
if (r < 0)
@@ -387,8 +387,8 @@ static int user_start_service(User *u) {
assert(u);
if (!u->service) {
- char lu[DECIMAL_STR_MAX(unsigned long) + 1], *service;
- sprintf(lu, "%lu", (unsigned long) u->uid);
+ char lu[DECIMAL_STR_MAX(uid_t) + 1], *service;
+ sprintf(lu, UID_FMT, u->uid);
service = unit_name_build("user", lu, ".service");
if (!service)
diff --git a/src/login/logind.c b/src/login/logind.c
index 686506cc65..7a7bd97150 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -1160,7 +1160,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
- log_debug("systemd-logind running as pid %lu", (unsigned long) getpid());
+ log_debug("systemd-logind running as pid "PID_FMT, getpid());
sd_notify(false,
"READY=1\n"
@@ -1168,7 +1168,7 @@ int main(int argc, char *argv[]) {
r = manager_run(m);
- log_debug("systemd-logind stopped as pid %lu", (unsigned long) getpid());
+ log_debug("systemd-logind stopped as pid "PID_FMT, getpid());
finish:
sd_notify(false,
diff --git a/src/login/pam-module.c b/src/login/pam-module.c
index 1259457efc..262621d43f 100644
--- a/src/login/pam-module.c
+++ b/src/login/pam-module.c
@@ -184,7 +184,7 @@ static int export_legacy_dbus_address(
return PAM_SUCCESS;
if (asprintf(&s, KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT,
- (unsigned long) uid, runtime) < 0) {
+ uid, runtime) < 0) {
pam_syslog(handle, LOG_ERR, "Failed to set bus variable.");
return PAM_BUF_ERR;
}
@@ -252,7 +252,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
if (streq_ptr(service, "systemd-user")) {
_cleanup_free_ char *p = NULL, *rt = NULL;
- if (asprintf(&p, "/run/systemd/users/%lu", (unsigned long) pw->pw_uid) < 0)
+ if (asprintf(&p, "/run/systemd/users/"UID_FMT, pw->pw_uid) < 0)
return PAM_BUF_ERR;
r = parse_env_file(p, NEWLINE,
diff --git a/src/login/test-inhibit.c b/src/login/test-inhibit.c
index 70780c30af..21d2339616 100644
--- a/src/login/test-inhibit.c
+++ b/src/login/test-inhibit.c
@@ -73,8 +73,8 @@ static void print_inhibitors(sd_bus *bus) {
assert(r >= 0);
while ((r = sd_bus_message_read(reply, "(ssssuu)", &what, &who, &why, &mode, &uid, &pid)) > 0) {
- printf("what=<%s> who=<%s> why=<%s> mode=<%s> uid=<%lu> pid=<%lu>\n",
- what, who, why, mode, (unsigned long) uid, (unsigned long) pid);
+ printf("what=<%s> who=<%s> why=<%s> mode=<%s> uid=<"UID_FMT"> pid=<"PID_FMT">\n",
+ what, who, why, mode, uid, pid);
n++;
}