chiark / gitweb /
shared: procfs_file_alloca: handle pid==0
[elogind.git] / src / core / killall.c
index ea9bfa105e0c35d5139852d65e656160aa1a2adc..57ed41c5afe4d2eb62e3adb20562a65f9de10e24 100644 (file)
@@ -33,7 +33,8 @@
 
 static bool ignore_proc(pid_t pid) {
         _cleanup_fclose_ FILE *f = NULL;
-        char c, *p;
+        char c;
+        const char *p;
         size_t count;
         uid_t uid;
         int r;
@@ -170,12 +171,12 @@ static int killall(int sig, Set *pids, bool send_sighup) {
                         _cleanup_free_ char *s;
 
                         get_process_comm(pid, &s);
-                        log_notice("Sending SIGKILL to PID %lu (%s).", (unsigned long) pid, strna(s));
+                        log_notice("Sending SIGKILL to PID "PID_FMT" (%s).", pid, strna(s));
                 }
 
                 if (kill(pid, sig) >= 0) {
                         if (pids)
-                                set_put(pids, ULONG_TO_PTR((unsigned long) pid));
+                                set_put(pids, ULONG_TO_PTR(pid));
                 } else if (errno != ENOENT)
                         log_warning("Could not kill %d: %m", pid);