diff --git a/lsof.spec b/lsof.spec index 7ff0203..fb49692 100644 --- a/lsof.spec +++ b/lsof.spec @@ -1,7 +1,7 @@ Summary: A utility which lists open files on a Linux/UNIX system. Name: lsof Version: 4.78 -Release: 2 +Release: 3 License: Free %define lsofrh lsof_4.78C-rh Group: Development/Debuggers @@ -22,7 +22,7 @@ UNIX system. %prep %setup -q -n %{lsofrh} -%patch1 -p1 -b .kzak +%patch1 -p1 %build LSOF_VSTR=2.6.16 LINUX_BASE=/proc ./Configure -n linux @@ -46,6 +46,9 @@ rm -rf ${RPM_BUILD_ROOT} %{_mandir}/man*/* %changelog +* Thu Aug 10 2006 Karel Zak 4.78-3 +- minor changes to thread patch + * Wed Aug 9 2006 Karel Zak 4.78-2 - fix #184338 - allow lsof access nptl threads diff --git a/lsof_4.78C-threads.patch b/lsof_4.78C-threads.patch index 58284e2..6f28078 100644 --- a/lsof_4.78C-threads.patch +++ b/lsof_4.78C-threads.patch @@ -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 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 @@ _PROTOTYPE(static int read_proc_stat,(char *p, int pid, char **cmd, int *ppid, int *pgid)); @@ -48,7 +48,7 @@ n += (pidx + 1); /* * Process the PID's stat info. -@@ -897,6 +913,60 @@ +@@ -897,6 +913,64 @@ (void) fclose(ms); } @@ -68,13 +68,15 @@ + char pstate; + FILE *f; + int _pid; -+ int re = 0; ++ int re = 0, x; + + snpf(path, sizeof(path), "%s/%d/stat", PROCFS, pid); + if (!(f = fopen(path, "r"))) -+ return; -+ fscanf(f, "%d %*s %c", &_pid, &pstate); ++ return -1; ++ x = fscanf(f, "%d %*s %c", &_pid, &pstate); + fclose(f); ++ if (x!=2) ++ return -1; + if (_pid != pid) + return -1; /* corrupted /proc? */ + if (pstate!='Z') @@ -95,8 +97,10 @@ + snpf(path, sizeof(path), "%s/%d/task/%s/stat", PROCFS, pid, td->d_name); + if (!(f = fopen(path, "r"))) + continue; -+ fscanf(f, "%*d %*s %c", &pstate); ++ x = fscanf(f, "%*d %*s %c", &pstate); + fclose(f); ++ if (x!=1) ++ continue; + if (pstate!='Z') { + re = 1; + *tid = strdup(td->d_name); @@ -109,7 +113,7 @@ /* * 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) return(1); /*