1 --- sysvinit-2.86/man/pidof.8.chroot 1998-09-02 08:49:33.000000000 -0400
2 +++ sysvinit-2.86/man/pidof.8 2005-12-19 15:37:40.000000000 -0500
14 Single shot - this instructs the program to only return one \fIpid\fP.
16 +Only return process ids that are running with the same root directory.
17 +This option is ignored for non-root users, as they will be unable to check
18 +the current root directory of processes they do not own.
20 Scripts too - this causes the program to also return process id's of
21 shells running the named scripts.
22 --- sysvinit-2.86/src/killall5.c.chroot 2004-07-30 08:16:23.000000000 -0400
23 +++ sysvinit-2.86/src/killall5.c 2005-12-19 15:38:47.000000000 -0500
27 int i, oind, opt, flags = 0;
28 + int chroot_check = 0;
32 for (oind = PIDOF_OMITSZ-1; oind > 0; oind--)
36 - while ((opt = getopt(argc,argv,"ho:sx")) != EOF) switch (opt) {
37 + while ((opt = getopt(argc,argv,"hco:sx")) != EOF) switch (opt) {
39 nsyslog(LOG_ERR,"invalid options on command line!\n");
43 + if (geteuid() == 0) chroot_check = 1;
46 if (oind >= PIDOF_OMITSZ -1) {
47 nsyslog(LOG_ERR,"omit pid buffer size %d "
52 + /* Check if we are in a chroot */
54 + snprintf(tmp, 512, "/proc/%d/root", getpid());
55 + if (stat(tmp, &st) < 0) {
56 + nsyslog(LOG_ERR, "stat failed for %s!\n", tmp);
62 /* Print out process-ID's one by one. */
64 for(f = 0; f < argc; f++) {
71 + snprintf(tmp, 512, "/proc/%d/root",
73 + if (stat(tmp, &st2) < 0 ||
74 + st.st_dev != st2.st_dev ||
75 + st.st_ino != st2.st_ino) {