summaryrefslogtreecommitdiff
path: root/procps/fuser.c
diff options
context:
space:
mode:
Diffstat (limited to 'procps/fuser.c')
-rw-r--r--procps/fuser.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/procps/fuser.c b/procps/fuser.c
index 1a4f612f1..2965fc34b 100644
--- a/procps/fuser.c
+++ b/procps/fuser.c
@@ -9,18 +9,6 @@
9 */ 9 */
10 10
11#include "busybox.h" 11#include "busybox.h"
12#include <stdio.h>
13#include <stdlib.h>
14#include <unistd.h>
15#include <string.h>
16#include <limits.h>
17#include <dirent.h>
18#include <signal.h>
19#include <sys/types.h>
20#include <sys/ioctl.h>
21#include <sys/stat.h>
22#include <sys/socket.h>
23#include <sys/sysmacros.h>
24 12
25#define FUSER_PROC_DIR "/proc" 13#define FUSER_PROC_DIR "/proc"
26#define FUSER_MAX_LINE 255 14#define FUSER_MAX_LINE 255
@@ -335,7 +323,7 @@ int fuser_main(int argc, char **argv)
335 optn = fuser_option(argv[i]); 323 optn = fuser_option(argv[i]);
336 if(optn) opt |= optn; 324 if(optn) opt |= optn;
337 else if(argv[i][0] == '-') { 325 else if(argv[i][0] == '-') {
338 if(!(u_signal_names(argv[i]+1, &killsig, 0))) 326 if(0>(killsig = get_signum(argv[i]+1)))
339 killsig = SIGTERM; 327 killsig = SIGTERM;
340 } 328 }
341 else { 329 else {
@@ -345,7 +333,6 @@ int fuser_main(int argc, char **argv)
345 } 333 }
346 if(!fnic) return 1; 334 if(!fnic) return 1;
347 335
348 pids = xmalloc(sizeof(pid_list));
349 inodes = xmalloc(sizeof(inode_list)); 336 inodes = xmalloc(sizeof(inode_list));
350 for(i=0;i<fnic;i++) { 337 for(i=0;i<fnic;i++) {
351 if(fuser_parse_net_arg(argv[fni[i]], &proto, &port)) { 338 if(fuser_parse_net_arg(argv[fni[i]], &proto, &port)) {
@@ -354,14 +341,13 @@ int fuser_main(int argc, char **argv)
354 else { 341 else {
355 if(!fuser_file_to_dev_inode( 342 if(!fuser_file_to_dev_inode(
356 argv[fni[i]], &dev, &inode)) { 343 argv[fni[i]], &dev, &inode)) {
357 free(pids); 344 if (ENABLE_FEATURE_CLEAN_UP) free(inodes);
358 free(inodes); 345 bb_perror_msg_and_die("Could not open '%s'", argv[fni[i]]);
359 bb_perror_msg_and_die(
360 "Could not open '%s'", argv[fni[i]]);
361 } 346 }
362 fuser_add_inode(inodes, dev, inode); 347 fuser_add_inode(inodes, dev, inode);
363 } 348 }
364 } 349 }
350 pids = xmalloc(sizeof(pid_list));
365 success = fuser_scan_proc_pids(opt, inodes, pids); 351 success = fuser_scan_proc_pids(opt, inodes, pids);
366 /* if the first pid in the list is 0, none have been found */ 352 /* if the first pid in the list is 0, none have been found */
367 if(pids->pid == 0) success = 0; 353 if(pids->pid == 0) success = 0;