diff --git a/procps/fuser.c b/procps/fuser.c
index 0258945..7ee56fb 100644
--- a/procps/fuser.c
+++ b/procps/fuser.c
@@ -1,6 +1,6 @@
 /*
- * tiny fuser implementation 
- * 
+ * tiny fuser implementation
+ *
  * Copyright 2004 Tony J. White
  *
  * May be distributed under the conditions of the
@@ -25,9 +25,9 @@
 
 #define FUSER_OPT_MOUNT  1
 #define FUSER_OPT_KILL   2
-#define FUSER_OPT_SILENT 4 
-#define FUSER_OPT_IP6    8 
-#define FUSER_OPT_IP4    16 
+#define FUSER_OPT_SILENT 4
+#define FUSER_OPT_IP6    8
+#define FUSER_OPT_IP4    16
 
 typedef struct inode_list {
 	ino_t inode;
@@ -40,7 +40,7 @@
 	struct pid_list *next;
 } pid_list;
 
-static int fuser_option(char *option) 
+static int fuser_option(char *option)
 {
 	int opt = 0;
 
@@ -55,7 +55,7 @@
 		else if(*option == '4') opt |= FUSER_OPT_IP4;
 		else {
 			bb_error_msg_and_die(
-				"Unsupported option '%c'", *option); 
+				"Unsupported option '%c'", *option);
 		}
 		++option;
 	}
@@ -69,13 +69,13 @@
 	if((stat(filename, &f_stat)) < 0) return 0;
 	*inode = f_stat.st_ino;
 	*dev = f_stat.st_dev;
-        return 1;
+	return 1;
 }
 
 static int fuser_find_socket_dev(dev_t *dev) {
 	int fd = socket(PF_INET, SOCK_DGRAM,0);
 	struct stat buf;
-	
+
 	if (fd >= 0 && (fstat(fd, &buf)) == 0) {
 		*dev =  buf.st_dev;
 		close(fd);
@@ -84,8 +84,8 @@
 	return 0;
 }
 
-static int fuser_parse_net_arg(const char *filename, 
-	const char **proto, int *port) 
+static int fuser_parse_net_arg(const char *filename,
+	const char **proto, int *port)
 {
 	char path[sizeof(FUSER_PROC_DIR)+12], tproto[5];
 
@@ -93,51 +93,51 @@
 	sprintf(path, "%s/net/%s", FUSER_PROC_DIR, tproto);
 	if((access(path, R_OK)) != 0) return 0;
 	*proto = bb_xstrdup(tproto);
-	return 1;	
+	return 1;
 }
 
 static int fuser_add_pid(pid_list *plist, pid_t pid)
 {
-        pid_list *curr = NULL, *last = NULL;
-        
-        if(plist->pid == 0) plist->pid = pid;
-        curr = plist;
-        while(curr != NULL) {
-                if(curr->pid == pid) return 1;
-                last = curr;
-                curr = curr->next;
-        }
-        curr = xmalloc(sizeof(pid_list));
-        last->next = curr;
-        curr->pid = pid;
+	pid_list *curr = NULL, *last = NULL;
+
+	if(plist->pid == 0) plist->pid = pid;
+	curr = plist;
+	while(curr != NULL) {
+		if(curr->pid == pid) return 1;
+		last = curr;
+		curr = curr->next;
+	}
+	curr = xmalloc(sizeof(pid_list));
+	last->next = curr;
+	curr->pid = pid;
 	curr->next = NULL;
-        return 1;
+	return 1;
 }
 
 static int fuser_add_inode(inode_list *ilist, dev_t dev, ino_t inode)
 {
-        inode_list *curr = NULL, *last = NULL;
-                                                                                
-        if(!ilist->inode && !ilist->dev) {
+	inode_list *curr = NULL, *last = NULL;
+
+	if(!ilist->inode && !ilist->dev) {
 		ilist->dev = dev;
 		ilist->inode = inode;
 	}
-        curr = ilist;
-        while(curr != NULL) {
-                if(curr->inode == inode && curr->dev == dev) return 1;
-                last = curr;
-                curr = curr->next;
-        }
-        curr = xmalloc(sizeof(inode_list));
-        last->next = curr;
-        curr->dev = dev;
-        curr->inode = inode;
+	curr = ilist;
+	while(curr != NULL) {
+		if(curr->inode == inode && curr->dev == dev) return 1;
+		last = curr;
+		curr = curr->next;
+	}
+	curr = xmalloc(sizeof(inode_list));
+	last->next = curr;
+	curr->dev = dev;
+	curr->inode = inode;
 	curr->next = NULL;
-        return 1;
+	return 1;
 }
 
-static int fuser_scan_proc_net(int opts, const char *proto, 
-	int port, inode_list *ilist) 
+static int fuser_scan_proc_net(int opts, const char *proto,
+	int port, inode_list *ilist)
 {
 	char path[sizeof(FUSER_PROC_DIR)+12], line[FUSER_MAX_LINE+1];
 	char addr[128];
@@ -156,10 +156,10 @@
 			"%*d: %64[0-9A-Fa-f]:%x %*x:%*x %*x %*x:%*x "
 			"%*x:%*x %*x %*d %*d %llu",
 			addr, &tmp_port, &uint64_inode) == 3) {
-			if((strlen(addr) == 8) && 
+			if((strlen(addr) == 8) &&
 				(opts & FUSER_OPT_IP6)) continue;
 			else if((strlen(addr) > 8) &&
-				(opts & FUSER_OPT_IP4)) continue; 
+				(opts & FUSER_OPT_IP4)) continue;
 			if(tmp_port == port) {
 				tmp_inode = uint64_inode;
 				fuser_add_inode(ilist, tmp_dev, tmp_inode);
@@ -171,24 +171,24 @@
 	return 1;
 }
 
-static int fuser_search_dev_inode(int opts, inode_list *ilist, 
-	dev_t dev, ino_t inode) 
+static int fuser_search_dev_inode(int opts, inode_list *ilist,
+	dev_t dev, ino_t inode)
 {
-        inode_list *curr;
-        curr = ilist;
+	inode_list *curr;
+	curr = ilist;
 
-        while(curr) {
+	while(curr) {
 		if((opts & FUSER_OPT_MOUNT) &&  curr->dev == dev)
 			return 1;
 		if(curr->inode == inode && curr->dev == dev)
 			return 1;
-                curr = curr->next;
-        }
-        return 0;
+		curr = curr->next;
+	}
+	return 0;
 }
 
 static int fuser_scan_pid_maps(int opts, const char *fname, pid_t pid,
-	inode_list *ilist, pid_list *plist) 
+	inode_list *ilist, pid_list *plist)
 {
 	FILE *file;
 	char line[FUSER_MAX_LINE + 1];
@@ -199,28 +199,28 @@
 
 	if (!(file = fopen(fname, "r"))) return 0;
 	while (fgets(line, FUSER_MAX_LINE, file)) {
-		if(sscanf(line, "%*s %*s %*s %x:%x %llu", 
+		if(sscanf(line, "%*s %*s %*s %x:%x %llu",
 			&major, &minor, &uint64_inode) != 3) continue;
 		inode = uint64_inode;
 		if(major == 0 && minor == 0 && inode == 0) continue;
-		dev = makedev(major, minor);		
+		dev = makedev(major, minor);
 		if(fuser_search_dev_inode(opts, ilist, dev, inode)) {
 			fuser_add_pid(plist, pid);
 		}
-		
+
 	}
 	fclose(file);
 	return 1;
 }
 
-static int fuser_scan_link(int opts, const char *lname, pid_t pid, 
-	inode_list *ilist, pid_list *plist) 
+static int fuser_scan_link(int opts, const char *lname, pid_t pid,
+	inode_list *ilist, pid_list *plist)
 {
 	ino_t inode;
-	dev_t dev;	
+	dev_t dev;
 
 	if(!fuser_file_to_dev_inode(lname, &dev, &inode)) return 0;
-	if(fuser_search_dev_inode(opts, ilist, dev, inode)) 
+	if(fuser_search_dev_inode(opts, ilist, dev, inode))
 		fuser_add_pid(plist, pid);
 	return 1;
 }
@@ -245,9 +245,9 @@
 	else return 0;
 	return 1;
 
-} 
+}
 
-static int fuser_scan_proc_pids(int opts, inode_list *ilist, pid_list *plist) 
+static int fuser_scan_proc_pids(int opts, inode_list *ilist, pid_list *plist)
 {
 	DIR *d;
 	struct dirent *de;
@@ -261,7 +261,7 @@
 		dname = concat_subpath_file(FUSER_PROC_DIR, de->d_name);
 		if(chdir(dname) < 0) {
 			free(dname);
-			continue; 
+			continue;
 		}
 		free(dname);
 		fuser_scan_link(opts, "cwd", pid, ilist, plist);
@@ -272,8 +272,8 @@
 		fuser_scan_dir_links(opts, "mmap", pid, ilist, plist);
 		fuser_scan_pid_maps(opts, "maps", pid, ilist, plist);
 		chdir("..");
-	} 
-	closedir(d);	
+	}
+	closedir(d);
 	return 1;
 }
 
@@ -290,22 +290,22 @@
 }
 
 static int fuser_kill_pid_list(pid_list *plist, int sig) {
-        pid_list *curr = plist;
+	pid_list *curr = plist;
 	pid_t mypid = getpid();
 	int success = 1;
 
 	if(plist == NULL) return 0;
-        while(curr != NULL) {
+	while(curr != NULL) {
 		if(curr->pid > 0 && curr->pid != mypid) {
-			if (kill(curr->pid, sig) != 0) { 
-                                bb_perror_msg(
+			if (kill(curr->pid, sig) != 0) {
+				bb_perror_msg(
 					"Could not kill pid '%d'", curr->pid);
-				success = 0;		
+				success = 0;
 			}
 		}
-                curr = curr->next;
-        }
-        return success;
+		curr = curr->next;
+	}
+	return success;
 }
 
 extern int fuser_main(int argc, char **argv) {
@@ -324,7 +324,7 @@
 	fni = xmalloc(sizeof(int));
 	for(i=1;i<argc;i++) {
 		optn = fuser_option(argv[i]);
-		if(optn) opt |= optn; 
+		if(optn) opt |= optn;
 		else if(argv[i][0] == '-') {
 			if(!(u_signal_names(argv[i]+1, &killsig, 0)))
 				killsig = SIGTERM;
@@ -368,4 +368,4 @@
 	free(inodes);
 	/* return 0 on (success == 1) 1 otherwise */
 	return (success != 1);
-} 
+}
