chiark / gitweb /
core: while we are reloading don't suppress bus signals
[elogind.git] / src / shared / util.c
index 04811ff26b8a64f94d9629e9fc27d1102232a78a..ceee6f2c90f6a7eecb1372d22e03b85a72184970 100644 (file)
@@ -729,6 +729,8 @@ int is_kernel_thread(pid_t pid) {
 
 int get_process_exe(pid_t pid, char **name) {
         const char *p;
+        char *d;
+        int r;
 
         assert(pid >= 0);
         assert(name);
@@ -738,7 +740,15 @@ int get_process_exe(pid_t pid, char **name) {
         else
                 p = procfs_file_alloca(pid, "exe");
 
-        return readlink_malloc(p, name);
+        r = readlink_malloc(p, name);
+        if (r < 0)
+                return r;
+
+        d = endswith(*name, " (deleted)");
+        if (d)
+                *d = '\0';
+
+        return 0;
 }
 
 static int get_process_id(pid_t pid, const char *field, uid_t *uid) {