add missing patch :-(

This commit is contained in:
kzak 2007-04-02 11:44:38 +00:00
parent bd41506217
commit ec56516607

View File

@ -0,0 +1,37 @@
--- psmisc-22.3/src/killall.c.kzak 2007-04-02 11:45:04.000000000 +0200
+++ psmisc-22.3/src/killall.c 2007-04-02 12:56:54.000000000 +0200
@@ -372,16 +372,29 @@
}
else
{
+ int ok = 1;
+
if (asprintf (&path, PROC_BASE "/%d/exe", pid_table[i]) < 0)
continue;
if (stat (path, &st) < 0)
+ ok = 0;
+
+ else if (sts[j].st_dev != st.st_dev ||
+ sts[j].st_ino != st.st_ino)
{
- free (path);
- continue;
- }
- free (path);
- if (sts[j].st_dev != st.st_dev || sts[j].st_ino != st.st_ino)
+ /* maybe the binary has been modified and std[j].st_ino
+ * is not reliable anymore. We need to compare paths.
+ */
+ char linkbuf[PATH_MAX];
+
+ if (readlink(path, linkbuf, sizeof(linkbuf)) <= 0 ||
+ strcmp(namelist[j], linkbuf))
+ ok = 0;
+ }
+
+ free(path);
+ if (!ok)
continue;
}
} /* non-regex */