ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/pack/freebsd/sysutils/psmisc/files/patch-src-killall.c
(Generate patch)

Comparing freebsd/sysutils/psmisc/files/patch-src-killall.c (file contents):
Revision 279 by douglas, 2010-05-18T03:59:26-07:00 vs.
Revision 455 by douglas, 2011-08-06T22:25:30-07:00

# Line 1 | Line 1
1 < --- src/killall.c.orig  2009-12-18 21:45:36.000000000 +0900
2 < +++ src/killall.c       2010-01-03 00:37:34.818411284 +0900
1 > --- src/killall.c.orig  2011-06-20 04:43:24.000000000 -0700
2 > +++ src/killall.c       2011-08-06 21:48:35.014330713 -0700
3   @@ -36,6 +36,8 @@
4   #include <dirent.h>
5   #include <signal.h>
# Line 9 | Line 9
9   #include <sys/types.h>
10   #include <sys/stat.h>
11   #include <getopt.h>
12 < @@ -83,40 +85,35 @@
12 > @@ -87,40 +89,35 @@
13              ignore_case = 0, pidof;
14   static long younger_than = 0, older_than = 0;
15  
# Line 34 | Line 34
34   -    else
35   -        printf (_("Signal %s(%s%d) ? (y/N) "), name, process_group ? "pgid " : "",
36   -               pid);
37 + -
38 + -    fflush (stdout);
39   +  int ch, c;
40  
39 -    fflush (stdout);
40 -
41   -    if (getline (&line, &len, stdin) < 0)
42   -      return 0;
43   -    /* Check for default */
# Line 74 | Line 74
74   }
75  
76   static double
77 < @@ -356,7 +353,7 @@
77 > @@ -197,7 +194,7 @@
78 >        
79 >        while (fgets(buf, sizeof buf, f))
80 >        {
81 > -               if (sscanf (buf, "Uid:\t%d", &puid))
82 > +               if (sscanf (buf, "%*s %*d %*d %*d %*d %*s %*s %*s %*s %*s %*s %*s %d", &puid))
83 >                {
84 >                        re = uid==puid;
85 >                        break;
86 > @@ -360,7 +357,7 @@
87           }
88   #endif /*WITH_SELINUX*/
89         /* load process name */
# Line 83 | Line 92
92          continue;
93         if (!(file = fopen (path, "r")))
94          {
95 < @@ -364,7 +361,7 @@
95 > @@ -368,7 +365,7 @@
96            continue;
97          }
98         free (path);
# Line 92 | Line 101
101         if (!okay) {
102          fclose(file);
103          continue;
104 < @@ -386,65 +383,6 @@
104 > @@ -390,65 +387,6 @@
105         got_long = 0;
106         command = NULL;          /* make gcc happy */
107         length = strlen (comm);
# Line 158 | Line 167
167         /* mach by process name */
168         for (j = 0; j < names; j++)
169          {
170 < @@ -495,7 +433,7 @@
170 > @@ -499,7 +437,7 @@
171                  {
172                    int ok = 1;
173  
# Line 167 | Line 176
176                      continue;
177  
178                    if (stat (path, &st) < 0)
179 < @@ -842,7 +780,7 @@
180 <     fprintf (stderr, _("Maximum number of names is %d\n"), MAX_NAMES);
181 <     exit (1);
182 <   }
183 < -  if (stat("/proc/self/stat", &isproc)==-1) {
184 < +  if (stat("/proc/curproc/status", &isproc)==-1) {
185 <     fprintf (stderr, _("%s is empty (not mounted ?)\n"), PROC_BASE);
186 <     exit (1);
187 <   }
179 > @@ -693,7 +631,7 @@
180 >   struct stat isproc;
181 >   pid_t pid = getpid();
182 >
183 > -  snprintf(filename, sizeof(filename), PROC_BASE"/%d/stat", (int) pid);
184 > +  snprintf(filename, sizeof(filename), PROC_BASE"/%d/status", (int) pid);
185 >   return stat(filename, &isproc) == 0;
186 > }
187 >

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines