summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-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/libsystemd/sd-login
parent12ed81d9c88406234c20e9261ae8c8b992d8bc4d (diff)
Remove unnecessary casts in printfs
No functional change expected :)
Diffstat (limited to 'src/libsystemd/sd-login')
-rw-r--r--src/libsystemd/sd-login/sd-login.c6
-rw-r--r--src/libsystemd/sd-login/test-login.c10
2 files changed, 8 insertions, 8 deletions
diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c
index 39445a191b..e7eea19580 100644
--- a/src/libsystemd/sd-login/sd-login.c
+++ b/src/libsystemd/sd-login/sd-login.c
@@ -172,7 +172,7 @@ _public_ int sd_uid_get_state(uid_t uid, char**state) {
assert_return(state, -EINVAL);
- if (asprintf(&p, "/run/systemd/users/%lu", (unsigned long) uid) < 0)
+ if (asprintf(&p, "/run/systemd/users/"UID_FMT, uid) < 0)
return -ENOMEM;
r = parse_env_file(p, NEWLINE, "STATE", &s, NULL);
@@ -215,7 +215,7 @@ _public_ int sd_uid_is_on_seat(uid_t uid, int require_active, const char *seat)
if (!s)
return -EIO;
- if (asprintf(&t, "%lu", (unsigned long) uid) < 0)
+ if (asprintf(&t, UID_FMT, uid) < 0)
return -ENOMEM;
FOREACH_WORD(w, l, s, state) {
@@ -231,7 +231,7 @@ static int uid_get_array(uid_t uid, const char *variable, char ***array) {
char **a;
int r;
- if (asprintf(&p, "/run/systemd/users/%lu", (unsigned long) uid) < 0)
+ if (asprintf(&p, "/run/systemd/users/"UID_FMT, uid) < 0)
return -ENOMEM;
r = parse_env_file(p, NEWLINE,
diff --git a/src/libsystemd/sd-login/test-login.c b/src/libsystemd/sd-login/test-login.c
index 9e326de5b4..ccf2c95816 100644
--- a/src/libsystemd/sd-login/test-login.c
+++ b/src/libsystemd/sd-login/test-login.c
@@ -47,7 +47,7 @@ static void test_login(void) {
printf("session = %s\n", session);
assert_se(sd_pid_get_owner_uid(0, &u2) == 0);
- printf("user = %lu\n", (unsigned long) u2);
+ printf("user = "UID_FMT"\n", u2);
assert_se(socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == 0);
sd_peer_get_session(pair[0], &pp);
@@ -88,7 +88,7 @@ static void test_login(void) {
free(state);
assert_se(sd_session_get_uid(session, &u) >= 0);
- printf("uid = %lu\n", (unsigned long) u);
+ printf("uid = "UID_FMT"\n", u);
assert_se(u == u2);
assert_se(sd_session_get_type(session, &type) >= 0);
@@ -137,7 +137,7 @@ static void test_login(void) {
assert_se(sd_seat_get_active(seat, &session2, &u2) >= 0);
printf("session2 = %s\n", session2);
- printf("uid2 = %lu\n", (unsigned long) u2);
+ printf("uid2 = "UID_FMT"\n", u2);
r = sd_seat_get_sessions(seat, &sessions, &uids, &n);
assert_se(r >= 0);
@@ -149,7 +149,7 @@ static void test_login(void) {
free(t);
printf("uids =");
for (k = 0; k < (int) n; k++)
- printf(" %lu", (unsigned long) uids[k]);
+ printf(" "UID_FMT, uids[k]);
printf("\n");
free(uids);
@@ -192,7 +192,7 @@ static void test_login(void) {
printf("uids =");
for (k = 0; k < r; k++)
- printf(" %lu", (unsigned long) uids[k]);
+ printf(" "UID_FMT, uids[k]);
printf("\n");
free(uids);