chiark / gitweb /
Remove unnecessary casts in printfs
[elogind.git] / src / libsystemd / sd-login / sd-login.c
index d24b2ed1fdd698f1b62bc04d5cdbe54b89c20df4..e7eea19580cb221c9bea3a12ee1aaaeca36e6cd9 100644 (file)
@@ -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,
@@ -775,7 +775,7 @@ _public_ int sd_login_monitor_new(const char *category, sd_login_monitor **m) {
         if (!category || streq(category, "seat")) {
                 k = inotify_add_watch(fd, "/run/systemd/seats/", IN_MOVED_TO|IN_DELETE);
                 if (k < 0) {
-                        close_nointr_nofail(fd);
+                        safe_close(fd);
                         return -errno;
                 }
 
@@ -785,7 +785,7 @@ _public_ int sd_login_monitor_new(const char *category, sd_login_monitor **m) {
         if (!category || streq(category, "session")) {
                 k = inotify_add_watch(fd, "/run/systemd/sessions/", IN_MOVED_TO|IN_DELETE);
                 if (k < 0) {
-                        close_nointr_nofail(fd);
+                        safe_close(fd);
                         return -errno;
                 }
 
@@ -795,7 +795,7 @@ _public_ int sd_login_monitor_new(const char *category, sd_login_monitor **m) {
         if (!category || streq(category, "uid")) {
                 k = inotify_add_watch(fd, "/run/systemd/users/", IN_MOVED_TO|IN_DELETE);
                 if (k < 0) {
-                        close_nointr_nofail(fd);
+                        safe_close(fd);
                         return -errno;
                 }
 
@@ -805,7 +805,7 @@ _public_ int sd_login_monitor_new(const char *category, sd_login_monitor **m) {
         if (!category || streq(category, "machine")) {
                 k = inotify_add_watch(fd, "/run/systemd/machines/", IN_MOVED_TO|IN_DELETE);
                 if (k < 0) {
-                        close_nointr_nofail(fd);
+                        safe_close(fd);
                         return -errno;
                 }