summaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorDenis Vlasenko2008-03-29 17:59:27 +0000
committerDenis Vlasenko2008-03-29 17:59:27 +0000
commit1b2058fe986a183d6b2f71145b166d683df82770 (patch)
treeb365eb81891029bf828ccdfa154009268ba1b9b0 /procps
parentf2f3868e0d69c586d395dc9187e0ca99d5e47880 (diff)
downloadbusybox-1b2058fe986a183d6b2f71145b166d683df82770.zip
busybox-1b2058fe986a183d6b2f71145b166d683df82770.tar.gz
fuser: fix vda's breakage: DOH! chdir'ing to /proc breaks relative paths
Diffstat (limited to 'procps')
-rw-r--r--procps/fuser.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/procps/fuser.c b/procps/fuser.c
index 48c9bdc..fd876d5 100644
--- a/procps/fuser.c
+++ b/procps/fuser.c
@@ -57,11 +57,11 @@ static int file_to_dev_inode(const char *filename, dev_t *dev, ino_t *inode)
static char *parse_net_arg(const char *arg, unsigned *port)
{
- char path[12], tproto[5];
+ char path[20], tproto[5];
if (sscanf(arg, "%u/%4s", port, tproto) != 2)
return NULL;
- sprintf(path, "net/%s", tproto);
+ sprintf(path, "/proc/net/%s", tproto);
if (access(path, R_OK) != 0)
return NULL;
return xstrdup(tproto);
@@ -99,7 +99,7 @@ static inode_list *add_inode(inode_list *ilist, dev_t dev, ino_t inode)
static inode_list *scan_proc_net(const char *proto,
unsigned port, inode_list *ilist)
{
- char path[12], line[MAX_LINE + 1];
+ char path[20], line[MAX_LINE + 1];
char addr[128];
ino_t tmp_inode;
dev_t tmp_dev;
@@ -109,7 +109,7 @@ static inode_list *scan_proc_net(const char *proto,
tmp_dev = find_socket_dev();
- sprintf(path, "net/%s", proto);
+ sprintf(path, "/proc/net/%s", proto);
f = fopen(path, "r");
if (!f)
return ilist;
@@ -314,8 +314,6 @@ Find processes which use FILEs or PORTs
opt = getopt32(argv, OPTION_STRING);
argv += optind;
- xchdir("/proc");
-
ilist = NULL;
pp = argv;
while (*pp) {