svn commit: trunk/busybox/procps

vda at busybox.net vda at busybox.net
Sat Mar 29 17:59:27 UTC 2008


Author: vda
Date: 2008-03-29 10:59:27 -0700 (Sat, 29 Mar 2008)
New Revision: 21562

Log:
fuser: fix vda's breakage: DOH! chdir'ing to /proc breaks relative paths



Modified:
   trunk/busybox/procps/fuser.c


Changeset:
Modified: trunk/busybox/procps/fuser.c
===================================================================
--- trunk/busybox/procps/fuser.c	2008-03-29 17:47:36 UTC (rev 21561)
+++ trunk/busybox/procps/fuser.c	2008-03-29 17:59:27 UTC (rev 21562)
@@ -57,11 +57,11 @@
 
 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 *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 @@
 
 	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 @@
 	opt = getopt32(argv, OPTION_STRING);
 	argv += optind;
 
-	xchdir("/proc");
-
 	ilist = NULL;
 	pp = argv;
 	while (*pp) {




More information about the busybox-cvs mailing list