fix minor bugs in previous commit
This commit is contained in:
parent
0ccc9f3c53
commit
043c656fa7
@ -1,7 +1,7 @@
|
|||||||
Summary: A utility which lists open files on a Linux/UNIX system.
|
Summary: A utility which lists open files on a Linux/UNIX system.
|
||||||
Name: lsof
|
Name: lsof
|
||||||
Version: 4.78
|
Version: 4.78
|
||||||
Release: 2
|
Release: 3
|
||||||
License: Free
|
License: Free
|
||||||
%define lsofrh lsof_4.78C-rh
|
%define lsofrh lsof_4.78C-rh
|
||||||
Group: Development/Debuggers
|
Group: Development/Debuggers
|
||||||
@ -22,7 +22,7 @@ UNIX system.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n %{lsofrh}
|
%setup -q -n %{lsofrh}
|
||||||
|
|
||||||
%patch1 -p1 -b .kzak
|
%patch1 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
LSOF_VSTR=2.6.16 LINUX_BASE=/proc ./Configure -n linux
|
LSOF_VSTR=2.6.16 LINUX_BASE=/proc ./Configure -n linux
|
||||||
@ -46,6 +46,9 @@ rm -rf ${RPM_BUILD_ROOT}
|
|||||||
%{_mandir}/man*/*
|
%{_mandir}/man*/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Aug 10 2006 Karel Zak <kzak@redhat.com> 4.78-3
|
||||||
|
- minor changes to thread patch
|
||||||
|
|
||||||
* Wed Aug 9 2006 Karel Zak <kzak@redhat.com> 4.78-2
|
* Wed Aug 9 2006 Karel Zak <kzak@redhat.com> 4.78-2
|
||||||
- fix #184338 - allow lsof access nptl threads
|
- fix #184338 - allow lsof access nptl threads
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
--- lsof_4.78C-rh/dialects/linux/dproc.c.kzak 2006-06-12 19:10:05.000000000 +0200
|
--- lsof_4.78C-rh/dialects/linux/dproc.c.kzak 2006-06-12 19:10:05.000000000 +0200
|
||||||
+++ lsof_4.78C-rh/dialects/linux/dproc.c 2006-08-09 23:25:14.000000000 +0200
|
+++ lsof_4.78C-rh/dialects/linux/dproc.c 2006-08-10 00:14:23.000000000 +0200
|
||||||
@@ -69,7 +69,8 @@
|
@@ -69,7 +69,8 @@
|
||||||
_PROTOTYPE(static int read_proc_stat,(char *p, int pid, char **cmd, int *ppid,
|
_PROTOTYPE(static int read_proc_stat,(char *p, int pid, char **cmd, int *ppid,
|
||||||
int *pgid));
|
int *pgid));
|
||||||
@ -48,7 +48,7 @@
|
|||||||
n += (pidx + 1);
|
n += (pidx + 1);
|
||||||
/*
|
/*
|
||||||
* Process the PID's stat info.
|
* Process the PID's stat info.
|
||||||
@@ -897,6 +913,60 @@
|
@@ -897,6 +913,64 @@
|
||||||
(void) fclose(ms);
|
(void) fclose(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,13 +68,15 @@
|
|||||||
+ char pstate;
|
+ char pstate;
|
||||||
+ FILE *f;
|
+ FILE *f;
|
||||||
+ int _pid;
|
+ int _pid;
|
||||||
+ int re = 0;
|
+ int re = 0, x;
|
||||||
+
|
+
|
||||||
+ snpf(path, sizeof(path), "%s/%d/stat", PROCFS, pid);
|
+ snpf(path, sizeof(path), "%s/%d/stat", PROCFS, pid);
|
||||||
+ if (!(f = fopen(path, "r")))
|
+ if (!(f = fopen(path, "r")))
|
||||||
+ return;
|
+ return -1;
|
||||||
+ fscanf(f, "%d %*s %c", &_pid, &pstate);
|
+ x = fscanf(f, "%d %*s %c", &_pid, &pstate);
|
||||||
+ fclose(f);
|
+ fclose(f);
|
||||||
|
+ if (x!=2)
|
||||||
|
+ return -1;
|
||||||
+ if (_pid != pid)
|
+ if (_pid != pid)
|
||||||
+ return -1; /* corrupted /proc? */
|
+ return -1; /* corrupted /proc? */
|
||||||
+ if (pstate!='Z')
|
+ if (pstate!='Z')
|
||||||
@ -95,8 +97,10 @@
|
|||||||
+ snpf(path, sizeof(path), "%s/%d/task/%s/stat", PROCFS, pid, td->d_name);
|
+ snpf(path, sizeof(path), "%s/%d/task/%s/stat", PROCFS, pid, td->d_name);
|
||||||
+ if (!(f = fopen(path, "r")))
|
+ if (!(f = fopen(path, "r")))
|
||||||
+ continue;
|
+ continue;
|
||||||
+ fscanf(f, "%*d %*s %c", &pstate);
|
+ x = fscanf(f, "%*d %*s %c", &pstate);
|
||||||
+ fclose(f);
|
+ fclose(f);
|
||||||
|
+ if (x!=1)
|
||||||
|
+ continue;
|
||||||
+ if (pstate!='Z') {
|
+ if (pstate!='Z') {
|
||||||
+ re = 1;
|
+ re = 1;
|
||||||
+ *tid = strdup(td->d_name);
|
+ *tid = strdup(td->d_name);
|
||||||
@ -109,7 +113,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* read_proc_stat() - read process status
|
* read_proc_stat() - read process status
|
||||||
@@ -931,12 +1001,6 @@
|
@@ -931,12 +1005,6 @@
|
||||||
if ((nf = get_fields(buf, (char *)NULL, &fp, (int *)NULL, 0)) < 5)
|
if ((nf = get_fields(buf, (char *)NULL, &fp, (int *)NULL, 0)) < 5)
|
||||||
return(1);
|
return(1);
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user