#ifdef FLASK_LINUX
security_id_t secsid;
#endif
+ pid_t pid; // saved until we have a proc_t allocated for sure
/* loop until a proc matching restrictions is found or no more processes */
/* I know this could be a while loop -- this way is easier to indent ;-) */
#define flags (PT->flags)
if (flags & PROC_PID) {
- pid_t pid = *(PT->pids)++;
+ pid = *(PT->pids)++;
if (unlikely(!pid)) return NULL;
- p->pid = pid;
snprintf(path, sizeof path, "/proc/%d", pid);
} else { /* get next numeric /proc ent */
for (;;) {
if(unlikely(unlikely(!ent) || unlikely(!ent->d_name))) return NULL;
if(likely( likely(*ent->d_name > '0') && likely(*ent->d_name <= '9') )) break;
}
- p->pid = strtoul(ent->d_name, NULL, 10);
+ pid = strtoul(ent->d_name, NULL, 10);
memcpy(path, "/proc/", 6);
strcpy(path+6, ent->d_name); // trust /proc to not contain evil top-level entries
// snprintf(path, sizeof path, "/proc/%s", ent->d_name);
if (!p)
p = xcalloc(p, sizeof *p); /* passed buf or alloced mem */
- p->euid = sb.st_uid; /* need a way to get real uid */
+ p->euid = sb.st_uid; /* need a way to get real uid */
#ifdef FLASK_LINUX
p->secsid = secsid;
#endif
+ p->pid = pid;
if (flags & PROC_FILLSTAT) { /* read, parse /proc/#/stat */
if (unlikely( file2str(path, "stat", sbuf, sizeof sbuf) == -1 ))
#ifdef FLASK_LINUX
security_id_t secsid;
#endif
+ pid_t pid; // saved until we have a proc_t allocated for sure
/* loop until a proc matching restrictions is found or no more processes */
/* I know this could be a while loop -- this way is easier to indent ;-) */
if(unlikely(unlikely(!ent) || unlikely(!ent->d_name))) return NULL;
if(likely( likely(*ent->d_name > '0') && likely(*ent->d_name <= '9') )) break;
}
- p->pid = strtoul(ent->d_name, NULL, 10);
+ pid = strtoul(ent->d_name, NULL, 10);
memcpy(path, "/proc/", 6);
strcpy(path+6, ent->d_name); // trust /proc to not contain evil top-level entries
// snprintf(path, sizeof path, "/proc/%s", ent->d_name);
if (!p)
p = xcalloc(p, sizeof *p); /* passed buf or alloced mem */
+
p->euid = sb.st_uid; /* need a way to get real uid */
#ifdef FLASK_LINUX
p->secsid = secsid;
#endif
+ p->pid = pid;
if ((file2str(path, "stat", sbuf, sizeof sbuf)) == -1)
goto next_proc; /* error reading /proc/#/stat */
Begin4
Title: procps
-Version: 3.1.4
+Version: 3.1.5
Entered-date: 2002-12-14
Description: Linux system utilities
Keywords: procps /proc libproc sysctl pmap
Author: Albert Cahalan, Michael K. Johnson, Jim Warner, etc.
Maintained-by: various <procps-feedback@lists.sf.net>
Primary-site: http://procps.sf.net/
- 236kB procps-3.1.4.tar.gz
+ 236kB procps-3.1.5.tar.gz
Alternate-site: http://www.debian.org/Packages/unstable/base/procps.html
- 236kB procps-3.1.4.tar.gz
+ 236kB procps-3.1.5.tar.gz
Copying-policy: mixed
End