forked from pool/psmisc
This commit is contained in:
parent
86d80c352e
commit
e7165bc8c3
@ -33,7 +33,7 @@
|
||||
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
|
||||
--- src/fuser.c
|
||||
+++ src/fuser.c 2008-10-01 16:37:41.410576528 +0200
|
||||
+++ src/fuser.c 2009-03-11 14:09:40.832002165 +0100
|
||||
@@ -32,9 +32,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -186,7 +186,7 @@
|
||||
if (stat(this_name->filename, &st) != 0) {
|
||||
fprintf(stderr,_("Cannot stat %s: %s\n"), this_name->filename,
|
||||
strerror(errno));
|
||||
@@ -342,34 +395,44 @@ int parse_file(struct names *this_name,
|
||||
@@ -342,34 +395,44 @@ int parse_file(struct names *this_name,
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@
|
||||
}
|
||||
|
||||
#ifdef WITH_IPV6
|
||||
@@ -652,6 +725,80 @@ void find_net6_sockets(struct inode_list
|
||||
@@ -652,6 +725,85 @@ void find_net6_sockets(struct inode_list
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -319,12 +319,17 @@
|
||||
+ if (real) strcpy(real, curr);
|
||||
+
|
||||
+ if (errno == EINVAL) {
|
||||
+ const size_t nlen = strlen(curr);
|
||||
+ struct nfs_points *p, *n, *l;
|
||||
+ n = mnts;
|
||||
+ l = (struct nfs_points*)0;
|
||||
+ for (p = mnts; n; p = n) {
|
||||
+ l = p->prev;
|
||||
+ n = p->next;
|
||||
+ if (nlen < p->nlen)
|
||||
+ continue;
|
||||
+ if (curr[p->nlen] != '\0' && curr[p->nlen] != '/')
|
||||
+ continue;
|
||||
+ if (!strncmp(curr, p->name, p->nlen))
|
||||
+ return 1;
|
||||
+ }
|
||||
@ -336,7 +341,7 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
opt_type opts;
|
||||
@@ -676,6 +823,7 @@ int main(int argc, char *argv[])
|
||||
@@ -676,6 +828,7 @@ int main(int argc, char *argv[])
|
||||
int optc;
|
||||
char *option;
|
||||
char *nsptr;
|
||||
@ -344,7 +349,7 @@
|
||||
|
||||
#ifdef WITH_IPV6
|
||||
ipv4_only = ipv6_only = 0;
|
||||
@@ -692,7 +840,6 @@ int main(int argc, char *argv[])
|
||||
@@ -692,7 +845,6 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
netdev = find_net_dev();
|
||||
@ -352,7 +357,7 @@
|
||||
fill_unix_cache(&unixsockets);
|
||||
|
||||
/* getopt doesnt like things like -SIGBLAH */
|
||||
@@ -782,6 +929,10 @@ int main(int argc, char *argv[])
|
||||
@@ -782,6 +934,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -363,7 +368,7 @@
|
||||
/* File specifications */
|
||||
if ( (this_name = malloc(sizeof(struct names))) == NULL)
|
||||
continue;
|
||||
@@ -828,10 +979,14 @@ int main(int argc, char *argv[])
|
||||
@@ -828,10 +984,14 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
default: /* FILE */
|
||||
this_name->filename = strdup(argv[optc]);
|
||||
@ -381,7 +386,7 @@
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -857,22 +1012,22 @@ int main(int argc, char *argv[])
|
||||
@@ -857,22 +1017,22 @@ int main(int argc, char *argv[])
|
||||
if (!ipv4_only) {
|
||||
#endif
|
||||
if (tcp_connection_list != NULL)
|
||||
@ -409,7 +414,7 @@
|
||||
#ifdef NFS_CHECKS
|
||||
scan_knfsd(names_head, match_devices);
|
||||
#endif /* NFS_CHECKS */
|
||||
@@ -978,7 +1133,7 @@ static int print_matches(struct names *n
|
||||
@@ -978,7 +1138,7 @@ static int print_matches(struct names *n
|
||||
|
||||
}
|
||||
|
||||
@ -418,7 +423,7 @@
|
||||
{
|
||||
char pathname[256];
|
||||
struct stat *st;
|
||||
@@ -986,6 +1141,10 @@ static struct stat *get_pidstat(const pi
|
||||
@@ -986,6 +1146,10 @@ static struct stat *get_pidstat(const pi
|
||||
if ( (st = malloc(sizeof(struct stat))) == NULL)
|
||||
return NULL;
|
||||
snprintf(pathname, 256, "/proc/%d/%s", pid, filename);
|
||||
@ -429,7 +434,7 @@
|
||||
if (stat(pathname, st) != 0)
|
||||
return NULL;
|
||||
else
|
||||
@@ -1012,13 +1171,14 @@ static void check_dir(const pid_t pid, c
|
||||
@@ -1012,13 +1176,14 @@ static void check_dir(const pid_t pid, c
|
||||
while ( (direntry = readdir(dirp)) != NULL) {
|
||||
if (direntry->d_name[0] < '0' || direntry->d_name[0] > '9')
|
||||
continue;
|
||||
@ -445,7 +450,7 @@
|
||||
if (st.st_dev == dev_tmp->device) {
|
||||
if (access == ACCESS_FILE && (lstat(filepath, &lst)==0) && (lst.st_mode & S_IWUSR)) {
|
||||
add_matched_proc(dev_tmp->name, pid,uid, ACCESS_FILEWR|access);
|
||||
@@ -1028,6 +1188,8 @@ static void check_dir(const pid_t pid, c
|
||||
@@ -1028,6 +1193,8 @@ static void check_dir(const pid_t pid, c
|
||||
}
|
||||
}
|
||||
for (ino_tmp = ino_head ; ino_tmp != NULL ; ino_tmp = ino_tmp->next) {
|
||||
@ -454,7 +459,7 @@
|
||||
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)) {
|
||||
add_matched_proc(ino_tmp->name, pid,uid, ACCESS_FILEWR|access);
|
||||
@@ -1039,6 +1201,8 @@ static void check_dir(const pid_t pid, c
|
||||
@@ -1039,6 +1206,8 @@ static void check_dir(const pid_t pid, c
|
||||
}
|
||||
} /* while fd_dent */
|
||||
closedir(dirp);
|
||||
@ -463,7 +468,7 @@
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -1059,12 +1223,18 @@ static void check_map(const pid_t pid, c
|
||||
@@ -1059,12 +1228,18 @@ static void check_map(const pid_t pid, c
|
||||
if (sscanf(line, "%*s %*s %*s %x:%x %lld",
|
||||
&tmp_maj, &tmp_min, &tmp_inode) == 3) {
|
||||
tmp_device = tmp_maj * 256 + tmp_min;
|
||||
@ -484,7 +489,7 @@
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
@@ -1135,6 +1305,16 @@ void fill_unix_cache(struct unixsocket_l
|
||||
@@ -1135,6 +1310,16 @@ void fill_unix_cache(struct unixsocket_l
|
||||
|
||||
}
|
||||
|
||||
@ -501,7 +506,7 @@
|
||||
/*
|
||||
* scan_mount_devices : Create a list of mount points and devices
|
||||
* This list is used later for matching purposes
|
||||
@@ -1144,17 +1324,53 @@ void scan_mount_devices(const opt_type o
|
||||
@@ -1144,17 +1329,53 @@ void scan_mount_devices(const opt_type o
|
||||
FILE *mntfp;
|
||||
struct mntent *mnt_ptr;
|
||||
struct stat st;
|
||||
@ -559,7 +564,7 @@
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -1280,3 +1496,56 @@ static void scan_knfsd(struct names *nam
|
||||
@@ -1280,3 +1501,56 @@ static void scan_knfsd(struct names *nam
|
||||
}
|
||||
}
|
||||
#endif /* NFSCHECKS */
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 11 14:24:06 CET 2009 - werner@suse.de
|
||||
|
||||
- nfs4fuser: make sure not to stumble on short named mount points
|
||||
to avoid to terminate processes on wrong mount points
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 9 16:35:51 CEST 2008 - werner@suse.de
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package psmisc (Version 22.6)
|
||||
#
|
||||
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -27,7 +27,7 @@ Group: System/Monitoring
|
||||
PreReq: %fillup_prereq %insserv_prereq
|
||||
AutoReqProv: on
|
||||
Version: 22.6
|
||||
Release: 61
|
||||
Release: 62
|
||||
Provides: ps:/usr/bin/killall
|
||||
Summary: Utilities for managing processes on your system
|
||||
Source: http://switch.dl.sourceforge.net/sourceforge/psmisc/psmisc-%{version}.tar.bz2
|
||||
@ -105,6 +105,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_mandir}/man1/pstree.1*
|
||||
|
||||
%changelog
|
||||
* Wed Mar 11 2009 werner@suse.de
|
||||
- nfs4fuser: make sure not to stumble on short named mount points
|
||||
to avoid to terminate processes on wrong mount points
|
||||
* Thu Oct 09 2008 werner@suse.de
|
||||
- Make compiler happy: Don't compare pointer with zero (bnc#432986)
|
||||
* Wed Oct 01 2008 werner@suse.de
|
||||
@ -136,7 +139,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
* Patch for peekfd from Benno Schulenberg
|
||||
* Fixed up NLS for fuser, patch from Benno Schulenberg
|
||||
* killall asks for Signal (procname) if not SIGTERM
|
||||
* Fri Oct 05 2007 bg@suse.de
|
||||
* Thu Oct 04 2007 bg@suse.de
|
||||
- Disable peekfd on hppa
|
||||
* Thu Apr 26 2007 werner@suse.de
|
||||
- Args, peekfd is ix86 specific, disable on other architectures
|
||||
|
Loading…
Reference in New Issue
Block a user