fuser: fix loop over kinfo_proc array
The previous code would skip as many entries at the end of the array as there were zombies in the list. While here fix type of cnt. Submitted by: Ali Abdallah <ali.abdallah suse.com> PR: 232702 MFC After: 2 weeks
This commit is contained in:
parent
0eccd618a3
commit
dd2b23006c
@ -163,12 +163,12 @@ int
|
|||||||
do_fuser(int argc, char *argv[])
|
do_fuser(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct consumer *consumer;
|
struct consumer *consumer;
|
||||||
struct kinfo_proc *p, *procs;
|
struct kinfo_proc *procs;
|
||||||
struct procstat *procstat;
|
struct procstat *procstat;
|
||||||
struct reqfile *reqfiles;
|
struct reqfile *reqfiles;
|
||||||
char *ep, *nlistf, *memf;
|
char *ep, *nlistf, *memf;
|
||||||
int ch, cnt, sig;
|
int ch, sig;
|
||||||
unsigned int i, nfiles;
|
unsigned int i, cnt, nfiles;
|
||||||
|
|
||||||
sig = SIGKILL; /* Default to kill. */
|
sig = SIGKILL; /* Default to kill. */
|
||||||
nlistf = NULL;
|
nlistf = NULL;
|
||||||
@ -253,10 +253,9 @@ do_fuser(int argc, char *argv[])
|
|||||||
/*
|
/*
|
||||||
* Walk through process table and look for matching files.
|
* Walk through process table and look for matching files.
|
||||||
*/
|
*/
|
||||||
p = procs;
|
for (i = 0; i < cnt; i++)
|
||||||
while(cnt--)
|
if (procs[i].ki_stat != SZOMB)
|
||||||
if (p->ki_stat != SZOMB)
|
dofiles(procstat, &procs[i], reqfiles, nfiles);
|
||||||
dofiles(procstat, p++, reqfiles, nfiles);
|
|
||||||
|
|
||||||
for (i = 0; i < nfiles; i++) {
|
for (i = 0; i < nfiles; i++) {
|
||||||
fprintf(stderr, "%s:", reqfiles[i].name);
|
fprintf(stderr, "%s:", reqfiles[i].name);
|
||||||
|
Loading…
Reference in New Issue
Block a user