OBS User autobuild 2009-10-12 14:47:10 +00:00 committed by Git OBS Bridge
parent 223d0f383d
commit 3d414e218c
4 changed files with 16 additions and 84 deletions

View File

@ -33,7 +33,7 @@
cannot report on any processes that it doesn't have permission to look at cannot report on any processes that it doesn't have permission to look at
the file descriptor table for. The most common time this problem occurs the file descriptor table for. The most common time this problem occurs
--- src/fuser.c --- src/fuser.c
+++ src/fuser.c 2009-10-09 18:43:54.839930561 +0200 +++ src/fuser.c 2009-05-11 13:45:16.565902120 +0200
@@ -32,9 +32,11 @@ @@ -32,9 +32,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -85,15 +85,6 @@
static void usage (const char *errormsg) static void usage (const char *errormsg)
{ {
@@ -92,7 +102,7 @@ static void usage (const char *errormsg)
" fuser -V\n"
"Show which processes use the named files, sockets, or filesystems.\n\n"
" -a display unused files too\n"
- " -c Same as \-m (for POSIX compatibility)\n"
+ " -c Same as -m (for POSIX compatibility)\n"
" -f silently ignored (for POSIX compatibility)\n"
" -i ask before killing (ignored without -k)\n"
" -k kill processes accessing the named file\n"
@@ -127,7 +137,14 @@ void print_version() @@ -127,7 +137,14 @@ void print_version()
"For more information about these matters, see the files named COPYING.\n")); "For more information about these matters, see the files named COPYING.\n"));
} }
@ -495,41 +486,25 @@
if (stat(pathname, st) != 0) if (stat(pathname, st) != 0)
return NULL; return NULL;
else else
@@ -1030,6 +1262,16 @@ static void check_dir(const pid_t pid, c @@ -1030,6 +1262,8 @@ static void check_dir(const pid_t pid, c
} }
} }
for (dev_tmp = dev_head ; dev_tmp != NULL ; dev_tmp = dev_tmp->next) { for (dev_tmp = dev_head ; dev_tmp != NULL ; dev_tmp = dev_tmp->next) {
+ if (dev_tmp->name->name_space & NAMESPACE_NFS) { + if (dev_tmp->name->name_space & NAMESPACE_NFS)
+ char buf[PATH_MAX+1];
+ ssize_t len;
+ if ((len = readlink(filepath, buf, PATH_MAX)) < 0)
+ continue;
+ buf[len] = '\0'; /* Don't be fooled by readlink(2) */
+ if (islocatedon(buf, dev_tmp->name->filename))
+ add_matched_proc(dev_tmp->name, pid,uid, access);
+ continue; + continue;
+ }
if (st.st_dev == dev_tmp->device) { if (st.st_dev == dev_tmp->device) {
if (access == ACCESS_FILE && (lstat(filepath, &lst)==0) && (lst.st_mode & S_IWUSR)) { if (access == ACCESS_FILE && (lstat(filepath, &lst)==0) && (lst.st_mode & S_IWUSR)) {
add_matched_proc(dev_tmp->name, pid,uid, ACCESS_FILEWR|access); add_matched_proc(dev_tmp->name, pid,uid, ACCESS_FILEWR|access);
@@ -1039,6 +1281,16 @@ static void check_dir(const pid_t pid, c @@ -1039,6 +1273,8 @@ static void check_dir(const pid_t pid, c
} }
} }
for (ino_tmp = ino_head ; ino_tmp != NULL ; ino_tmp = ino_tmp->next) { for (ino_tmp = ino_head ; ino_tmp != NULL ; ino_tmp = ino_tmp->next) {
+ if (ino_tmp->name->name_space & NAMESPACE_NFS) { + if (ino_tmp->name->name_space & NAMESPACE_NFS)
+ char buf[PATH_MAX+1];
+ ssize_t len;
+ if ((len = readlink(filepath, buf, PATH_MAX)) < 0)
+ continue;
+ buf[len] = '\0'; /* Don't be fooled by readlink(2) */
+ if (islocatedon(buf, ino_tmp->name->filename))
+ add_matched_proc(ino_tmp->name, pid,uid, access);
+ continue; + continue;
+ }
if (st.st_dev == ino_tmp->device && st.st_ino == ino_tmp->inode) { if (st.st_dev == ino_tmp->device && st.st_ino == ino_tmp->inode) {
if (access == ACCESS_FILE && (lstat(filepath, &lst)==0) && (lst.st_mode & S_IWUSR)) { if (access == ACCESS_FILE && (lstat(filepath, &lst)==0) && (lst.st_mode & S_IWUSR)) {
add_matched_proc(ino_tmp->name, pid,uid, ACCESS_FILEWR|access); add_matched_proc(ino_tmp->name, pid,uid, ACCESS_FILEWR|access);
@@ -1050,6 +1302,8 @@ static void check_dir(const pid_t pid, c @@ -1050,6 +1286,8 @@ static void check_dir(const pid_t pid, c
} }
} /* while fd_dent */ } /* while fd_dent */
closedir(dirp); closedir(dirp);
@ -538,46 +513,28 @@
} }
static void check_map(const pid_t pid, const char *filename, struct device_list *dev_head, struct inode_list *ino_head, const uid_t uid, const char access) static void check_map(const pid_t pid, const char *filename, struct device_list *dev_head, struct inode_list *ino_head, const uid_t uid, const char access)
@@ -1069,13 +1323,36 @@ static void check_map(const pid_t pid, c @@ -1070,12 +1308,18 @@ static void check_map(const pid_t pid, c
while (fgets(line,BUFSIZ, fp)) {
if (sscanf(line, "%*s %*s %*s %x:%x %lld", if (sscanf(line, "%*s %*s %*s %x:%x %lld",
&tmp_maj, &tmp_min, &tmp_inode) == 3) { &tmp_maj, &tmp_min, &tmp_inode) == 3) {
+ const char * filepath = strchr(line, '/');
tmp_device = tmp_maj * 256 + tmp_min; tmp_device = tmp_maj * 256 + tmp_min;
- for(dev_tmp = dev_head ; dev_tmp != NULL ; dev_tmp = dev_tmp->next) - for(dev_tmp = dev_head ; dev_tmp != NULL ; dev_tmp = dev_tmp->next)
+ for(dev_tmp = dev_head ; dev_tmp != NULL ; dev_tmp = dev_tmp->next) { + for(dev_tmp = dev_head ; dev_tmp != NULL ; dev_tmp = dev_tmp->next) {
+ if (dev_tmp->name->name_space & NAMESPACE_NFS) { + if (dev_tmp->name->name_space & NAMESPACE_NFS)
+ char *nl;
+ if (!filepath)
+ continue;
+ if ((nl = strchr(filepath, '\n')))
+ nl = '\0';
+ if (islocatedon(filepath, dev_tmp->name->filename))
+ add_matched_proc(dev_tmp->name, pid,uid, access);
+ continue; + continue;
+ }
if (dev_tmp->device == tmp_device) if (dev_tmp->device == tmp_device)
add_matched_proc(dev_tmp->name, pid, uid, access); add_matched_proc(dev_tmp->name, pid, uid, access);
- for(ino_tmp = ino_head ; ino_tmp != NULL ; ino_tmp = ino_tmp->next) - for(ino_tmp = ino_head ; ino_tmp != NULL ; ino_tmp = ino_tmp->next)
+ } + }
+ for(ino_tmp = ino_head ; ino_tmp != NULL ; ino_tmp = ino_tmp->next) { + for(ino_tmp = ino_head ; ino_tmp != NULL ; ino_tmp = ino_tmp->next) {
+ if (ino_tmp->name->name_space & NAMESPACE_NFS) { + if (ino_tmp->name->name_space & NAMESPACE_NFS)
+ char *nl;
+ if (!filepath)
+ continue;
+ if ((nl = strchr(filepath, '\n')))
+ nl = '\0';
+ if (islocatedon(filepath, ino_tmp->name->filename))
+ add_matched_proc(ino_tmp->name, pid,uid, access);
+ continue; + continue;
+ }
if (ino_tmp->device == tmp_device && ino_tmp->inode == tmp_inode) if (ino_tmp->device == tmp_device && ino_tmp->inode == tmp_inode)
add_matched_proc(ino_tmp->name, pid, uid, access); add_matched_proc(ino_tmp->name, pid, uid, access);
+ } + }
} }
} }
fclose(fp); fclose(fp);
@@ -1146,6 +1423,16 @@ void fill_unix_cache(struct unixsocket_l @@ -1146,6 +1390,16 @@ void fill_unix_cache(struct unixsocket_l
} }
@ -594,7 +551,7 @@
/* /*
* scan_mount_devices : Create a list of mount points and devices * scan_mount_devices : Create a list of mount points and devices
* This list is used later for matching purposes * This list is used later for matching purposes
@@ -1155,17 +1442,94 @@ void scan_mount_devices(const opt_type o @@ -1155,17 +1409,94 @@ void scan_mount_devices(const opt_type o
FILE *mntfp; FILE *mntfp;
struct mntent *mnt_ptr; struct mntent *mnt_ptr;
struct stat st; struct stat st;
@ -648,8 +605,8 @@
add_mount_device(mount_devices, mnt_ptr->mnt_fsname, mnt_ptr->mnt_dir, st.st_dev); add_mount_device(mount_devices, mnt_ptr->mnt_fsname, mnt_ptr->mnt_dir, st.st_dev);
+ } else { + } else {
+ fprintf(stderr, _("Cannot stat file %s: %s\n"), mnt_ptr->mnt_dir, strerror(errno)); + fprintf(stderr, _("Cannot stat file %s: %s\n"), mnt_ptr->mnt_dir, strerror(errno));
} + }
} + }
+ endmntent(mntfp); + endmntent(mntfp);
+ +
+ if (!mnts) + if (!mnts)
@ -684,14 +641,14 @@
+ s->next = p->shadow; + s->next = p->shadow;
+ s->prev = (struct shadow_list*)0; + s->prev = (struct shadow_list*)0;
+ p->shadow = s; + p->shadow = s;
+ } }
+ } }
+out: +out:
+ endmntent(mntfp); + endmntent(mntfp);
} }
#ifdef DEBUG #ifdef DEBUG
@@ -1291,3 +1655,56 @@ static void scan_knfsd(struct names *nam @@ -1291,3 +1622,56 @@ static void scan_knfsd(struct names *nam
} }
} }
#endif /* NFSCHECKS */ #endif /* NFSCHECKS */

View File

@ -1,12 +0,0 @@
--- src/pstree.c.orig 2008-12-16 11:13:35.000000000 +0100
+++ src/pstree.c 2009-10-08 19:37:59.000000000 +0200
@@ -749,6 +749,9 @@
exit (1);
}
(void) close (fd);
+ /* If we have read the maximum screen length of args, bring it back by one to stop overflow */
+ if (size >= buffer_size)
+ size--;
if (size)
buffer[size++] = 0;
#ifdef WITH_SELINUX

View File

@ -1,14 +1,3 @@
-------------------------------------------------------------------
Fri Oct 9 18:58:25 CEST 2009 - werner@suse.de
- Yet an other fix for NFS based file detection in fuser
-------------------------------------------------------------------
Fri Oct 9 08:20:29 UTC 2009 - aj@suse.de
- fix pstree -a crash (bnc#545265) with patch backported from 22.8
by Björn Voigt <bjoern@cs.tu-berlin.de>.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Sep 10 10:21:09 CEST 2009 - werner@suse.de Thu Sep 10 10:21:09 CEST 2009 - werner@suse.de

View File

@ -39,7 +39,6 @@ Patch4: %name-22.7-writeonly.patch
Patch5: %name-22.6-fdleak.patch Patch5: %name-22.6-fdleak.patch
Patch6: %name-22.6-tigetstr.patch Patch6: %name-22.6-tigetstr.patch
Patch7: %name-22.7-memleaks.patch Patch7: %name-22.7-memleaks.patch
Patch8: %name-22.8-to-22.7-backport.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define nopeek s390 s390x ia64 %arm %define nopeek s390 s390x ia64 %arm
@ -67,7 +66,6 @@ Authors:
%patch6 -p0 -b .tigetstr %patch6 -p0 -b .tigetstr
%patch7 -p0 -b .memleaks %patch7 -p0 -b .memleaks
%patch0 -p0 %patch0 -p0
%patch8 -p0
%build %build
autoreconf -fi autoreconf -fi