- sprintf(status, "/proc/%d/stat", pid);
- if((fp = fopen(status, "r")) == NULL)
- continue;
-#ifdef CONFIG_SELINUX
- if(use_selinux)
- {
- if(fstat_secure(fileno(fp), &sb, sid))
- continue;
- }
- else
-#endif
- name = fgets(buf, sizeof(buf), fp);
- fclose(fp);
- if(name == NULL)
+ /* see proc(5) for some details on this */
+ strcpy(status_tail, "/stat");
+ n = read_to_buf(status, buf);
+ if (n < 0)