summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-08-03 15:41:12 +0000
committerRob Landley <rob@landley.net>2006-08-03 15:41:12 +0000
commitd921b2ecc0d294ad4bf8c7458fc52a60c28727d2 (patch)
treee4a2769349867c441cf2983d83097bb66701a733 /util-linux
parent6dce0b6fa79f2d4bb7e9d90e1fbc0f6beb25f855 (diff)
downloadbusybox-w32-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.tar.gz
busybox-w32-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.tar.bz2
busybox-w32-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.zip
Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only had one user), clean up lots of #includes... General cleanup pass. What I've been doing for the last couple days. And it conflicts! I've removed httpd.c from this checkin due to somebody else touching that file. It builds for me. I have to catch a bus. (Now you know why I'm looking forward to Mercurial.)
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/fbset.c13
-rw-r--r--util-linux/fdformat.c24
-rw-r--r--util-linux/freeramdisk.c9
-rw-r--r--util-linux/getopt.c12
-rw-r--r--util-linux/hexdump.c3
-rw-r--r--util-linux/mdev.c10
-rw-r--r--util-linux/mkfs_minix.c20
-rw-r--r--util-linux/mkswap.c2
-rw-r--r--util-linux/more.c23
-rw-r--r--util-linux/mount.c16
-rw-r--r--util-linux/nfsmount.c10
-rw-r--r--util-linux/readprofile.c31
-rw-r--r--util-linux/umount.c4
13 files changed, 40 insertions, 137 deletions
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 7d3cae251..9a207b6e3 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -12,15 +12,6 @@
12 * Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be) 12 * Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
13 */ 13 */
14 14
15#include <stdio.h>
16#include <stdlib.h>
17#include <unistd.h>
18#include <fcntl.h>
19#include <errno.h>
20#include <ctype.h>
21#include <string.h>
22#include <stdint.h>
23#include <sys/ioctl.h>
24#include "busybox.h" 15#include "busybox.h"
25 16
26#define DEFAULTFBDEV FB_0 17#define DEFAULTFBDEV FB_0
@@ -186,7 +177,7 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn,
186 char buf[256]; 177 char buf[256];
187 char *p = buf; 178 char *p = buf;
188 179
189 f = bb_xfopen(fn, "r"); 180 f = xfopen(fn, "r");
190 while (!feof(f)) { 181 while (!feof(f)) {
191 fgets(buf, sizeof(buf), f); 182 fgets(buf, sizeof(buf), f);
192 if ((p = strstr(buf, "mode ")) || (p = strstr(buf, "mode\t"))) { 183 if ((p = strstr(buf, "mode ")) || (p = strstr(buf, "mode\t"))) {
@@ -396,7 +387,7 @@ int fbset_main(int argc, char **argv)
396 } 387 }
397 } 388 }
398 389
399 fh = bb_xopen(fbdev, O_RDONLY); 390 fh = xopen(fbdev, O_RDONLY);
400 if (ioctl(fh, FBIOGET_VSCREENINFO, &var)) 391 if (ioctl(fh, FBIOGET_VSCREENINFO, &var))
401 bb_perror_msg_and_die("fbset(ioctl)"); 392 bb_perror_msg_and_die("fbset(ioctl)");
402 if (g_options & OPT_READMODE) { 393 if (g_options & OPT_READMODE) {
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c
index f94d455c9..63ec2204d 100644
--- a/util-linux/fdformat.c
+++ b/util-linux/fdformat.c
@@ -9,14 +9,6 @@
9 * 5 July 2003 -- modified for Busybox by Erik Andersen 9 * 5 July 2003 -- modified for Busybox by Erik Andersen
10 */ 10 */
11 11
12#include <stdio.h>
13#include <string.h>
14#include <fcntl.h>
15#include <errno.h>
16#include <unistd.h>
17#include <stdlib.h>
18#include <sys/stat.h>
19#include <sys/ioctl.h>
20#include "busybox.h" 12#include "busybox.h"
21 13
22 14
@@ -60,10 +52,10 @@ static void print_and_flush(const char * __restrict format, ...)
60 va_start(arg, format); 52 va_start(arg, format);
61 bb_vfprintf(stdout, format, arg); 53 bb_vfprintf(stdout, format, arg);
62 va_end(arg); 54 va_end(arg);
63 bb_xfflush_stdout(); 55 xfflush_stdout();
64} 56}
65 57
66static void bb_xioctl(int fd, int request, void *argp, const char *string) 58static void xioctl(int fd, int request, void *argp, const char *string)
67{ 59{
68 if (ioctl (fd, request, argp) < 0) { 60 if (ioctl (fd, request, argp) < 0) {
69 bb_perror_msg_and_die(string); 61 bb_perror_msg_and_die(string);
@@ -95,9 +87,9 @@ int fdformat_main(int argc,char **argv)
95 87
96 88
97 /* O_RDWR for formatting and verifying */ 89 /* O_RDWR for formatting and verifying */
98 fd = bb_xopen(*argv,O_RDWR ); 90 fd = xopen(*argv,O_RDWR );
99 91
100 bb_xioctl(fd, FDGETPRM, &param, "FDGETPRM");/*original message was: "Could not determine current format type" */ 92 xioctl(fd, FDGETPRM, &param, "FDGETPRM");/*original message was: "Could not determine current format type" */
101 93
102 print_and_flush("%s-sided, %d tracks, %d sec/track. Total capacity %d kB.\n", 94 print_and_flush("%s-sided, %d tracks, %d sec/track. Total capacity %d kB.\n",
103 (param.head == 2) ? "Double" : "Single", 95 (param.head == 2) ? "Double" : "Single",
@@ -105,22 +97,22 @@ int fdformat_main(int argc,char **argv)
105 97
106 /* FORMAT */ 98 /* FORMAT */
107 print_and_flush("Formatting ... ", NULL); 99 print_and_flush("Formatting ... ", NULL);
108 bb_xioctl(fd, FDFMTBEG,NULL,"FDFMTBEG"); 100 xioctl(fd, FDFMTBEG,NULL,"FDFMTBEG");
109 101
110 /* n == track */ 102 /* n == track */
111 for (n = 0; n < param.track; n++) 103 for (n = 0; n < param.track; n++)
112 { 104 {
113 descr.head = 0; 105 descr.head = 0;
114 descr.track = n; 106 descr.track = n;
115 bb_xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK"); 107 xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK");
116 print_and_flush("%3d\b\b\b", n); 108 print_and_flush("%3d\b\b\b", n);
117 if (param.head == 2) { 109 if (param.head == 2) {
118 descr.head = 1; 110 descr.head = 1;
119 bb_xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK"); 111 xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK");
120 } 112 }
121 } 113 }
122 114
123 bb_xioctl(fd,FDFMTEND,NULL,"FDFMTEND"); 115 xioctl(fd,FDFMTEND,NULL,"FDFMTEND");
124 print_and_flush("done\n", NULL); 116 print_and_flush("done\n", NULL);
125 117
126 /* VERIFY */ 118 /* VERIFY */
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c
index c959158c9..9e1c453e4 100644
--- a/util-linux/freeramdisk.c
+++ b/util-linux/freeramdisk.c
@@ -9,13 +9,6 @@
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
10 */ 10 */
11 11
12#include <stdio.h>
13#include <string.h>
14#include <sys/types.h>
15#include <fcntl.h>
16#include <sys/ioctl.h>
17#include <stdlib.h>
18#include <unistd.h>
19#include "busybox.h" 12#include "busybox.h"
20 13
21/* From <linux/fd.h> */ 14/* From <linux/fd.h> */
@@ -28,7 +21,7 @@ int freeramdisk_main(int argc, char **argv)
28 21
29 if (argc != 2) bb_show_usage(); 22 if (argc != 2) bb_show_usage();
30 23
31 fd = bb_xopen(argv[1], O_RDWR); 24 fd = xopen(argv[1], O_RDWR);
32 25
33 // Act like freeramdisk, fdflush, or both depending on configuration. 26 // Act like freeramdisk, fdflush, or both depending on configuration.
34 result = ioctl(fd, (ENABLE_FREERAMDISK && bb_applet_name[1]=='r') 27 result = ioctl(fd, (ENABLE_FREERAMDISK && bb_applet_name[1]=='r')
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index fab8f8398..bf05f9164 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -31,14 +31,8 @@
31 * 31 *
32 */ 32 */
33 33
34#include <stdio.h>
35#include <stdlib.h>
36#include <string.h>
37#include <unistd.h>
38#include <ctype.h>
39#include <getopt.h>
40
41#include "busybox.h" 34#include "busybox.h"
35#include <getopt.h>
42 36
43/* NON_OPT is the code that is returned when a non-option is found in '+' 37/* NON_OPT is the code that is returned when a non-option is found in '+'
44 mode */ 38 mode */
@@ -86,7 +80,7 @@ const char *normalize(const char *arg)
86 free(BUFFER); 80 free(BUFFER);
87 81
88 if (!quote) { /* Just copy arg */ 82 if (!quote) { /* Just copy arg */
89 BUFFER=bb_xstrdup(arg); 83 BUFFER=xstrdup(arg);
90 return BUFFER; 84 return BUFFER;
91 } 85 }
92 86
@@ -215,7 +209,7 @@ void add_longopt(const char *name,int has_arg)
215 long_options[long_options_nr-1].has_arg=has_arg; 209 long_options[long_options_nr-1].has_arg=has_arg;
216 long_options[long_options_nr-1].flag=NULL; 210 long_options[long_options_nr-1].flag=NULL;
217 long_options[long_options_nr-1].val=LONG_OPT; 211 long_options[long_options_nr-1].val=LONG_OPT;
218 long_options[long_options_nr-1].name=bb_xstrdup(name); 212 long_options[long_options_nr-1].name=xstrdup(name);
219 } 213 }
220 long_options_nr++; 214 long_options_nr++;
221} 215}
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c
index 12f540a53..136243122 100644
--- a/util-linux/hexdump.c
+++ b/util-linux/hexdump.c
@@ -11,7 +11,6 @@
11 11
12#include "busybox.h" 12#include "busybox.h"
13#include <getopt.h> 13#include <getopt.h>
14#include <string.h>
15#include "dump.h" 14#include "dump.h"
16 15
17static void bb_dump_addfile(char *name) 16static void bb_dump_addfile(char *name)
@@ -20,7 +19,7 @@ static void bb_dump_addfile(char *name)
20 FILE *fp; 19 FILE *fp;
21 char *buf; 20 char *buf;
22 21
23 fp = bb_xfopen(name, "r"); 22 fp = xfopen(name, "r");
24 23
25 while ((buf = bb_get_chomped_line_from_file(fp)) != NULL) { 24 while ((buf = bb_get_chomped_line_from_file(fp)) != NULL) {
26 p = skip_whitespace(buf); 25 p = skip_whitespace(buf);
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index c77c122b5..7c1223dcb 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -10,10 +10,6 @@
10 */ 10 */
11 11
12#include "busybox.h" 12#include "busybox.h"
13#include <ctype.h>
14#include <errno.h>
15#include <sys/mman.h>
16#include <sys/sysmacros.h>
17#include "xregex.h" 13#include "xregex.h"
18 14
19#define DEV_PATH "/dev" 15#define DEV_PATH "/dev"
@@ -146,7 +142,7 @@ static void make_device(char *path, int delete)
146 break; 142 break;
147 } 143 }
148 if ((s2-s+1) & (1<<delete)) 144 if ((s2-s+1) & (1<<delete))
149 command = bb_xstrndup(pos, end-pos); 145 command = xstrndup(pos, end-pos);
150 } 146 }
151 147
152 pos = end2; 148 pos = end2;
@@ -180,7 +176,7 @@ static void make_device(char *path, int delete)
180 int rc; 176 int rc;
181 char *s; 177 char *s;
182 178
183 s=bb_xasprintf("MDEV=%s",device_name); 179 s=xasprintf("MDEV=%s",device_name);
184 putenv(s); 180 putenv(s);
185 rc = system(command); 181 rc = system(command);
186 s[4]=0; 182 s[4]=0;
@@ -232,7 +228,7 @@ int mdev_main(int argc, char *argv[])
232 char *env_path; 228 char *env_path;
233 RESERVE_CONFIG_BUFFER(temp,PATH_MAX); 229 RESERVE_CONFIG_BUFFER(temp,PATH_MAX);
234 230
235 bb_xchdir(DEV_PATH); 231 xchdir(DEV_PATH);
236 232
237 /* Scan */ 233 /* Scan */
238 234
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index 7f52b563e..a8737a6c9 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -62,20 +62,8 @@
62 * removed getopt based parser and added a hand rolled one. 62 * removed getopt based parser and added a hand rolled one.
63 */ 63 */
64 64
65#include <stdio.h>
66#include <time.h>
67#include <unistd.h>
68#include <string.h>
69#include <signal.h>
70#include <fcntl.h>
71#include <ctype.h>
72#include <stdlib.h>
73#include <stdint.h>
74#include <termios.h>
75#include <sys/ioctl.h>
76#include <sys/param.h>
77#include <mntent.h>
78#include "busybox.h" 65#include "busybox.h"
66#include <mntent.h>
79 67
80#define MINIX_ROOT_INO 1 68#define MINIX_ROOT_INO 1
81#define MINIX_LINK_MAX 250 69#define MINIX_LINK_MAX 250
@@ -304,7 +292,7 @@ static inline int get_size(const char *file)
304 int fd; 292 int fd;
305 long size; 293 long size;
306 294
307 fd = bb_xopen3(file, O_RDWR, 0); 295 fd = xopen3(file, O_RDWR, 0);
308 if (ioctl(fd, BLKGETSIZE, &size) >= 0) { 296 if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
309 close(fd); 297 close(fd);
310 return (size * 512); 298 return (size * 512);
@@ -678,7 +666,7 @@ static void get_list_blocks(char *filename)
678 FILE *listfile; 666 FILE *listfile;
679 unsigned long blockno; 667 unsigned long blockno;
680 668
681 listfile = bb_xfopen(filename, "r"); 669 listfile = xfopen(filename, "r");
682 while (!feof(listfile)) { 670 while (!feof(listfile)) {
683 fscanf(listfile, "%ld\n", &blockno); 671 fscanf(listfile, "%ld\n", &blockno);
684 mark_zone(blockno); 672 mark_zone(blockno);
@@ -817,7 +805,7 @@ goodbye:
817 tmp += dirsize; 805 tmp += dirsize;
818 *(short *) tmp = 2; 806 *(short *) tmp = 2;
819 strcpy(tmp + 2, ".badblocks"); 807 strcpy(tmp + 2, ".badblocks");
820 DEV = bb_xopen3(device_name, O_RDWR, 0); 808 DEV = xopen3(device_name, O_RDWR, 0);
821 if (fstat(DEV, &statbuf) < 0) 809 if (fstat(DEV, &statbuf) < 0)
822 bb_error_msg_and_die("unable to stat %s", device_name); 810 bb_error_msg_and_die("unable to stat %s", device_name);
823 if (!S_ISBLK(statbuf.st_mode)) 811 if (!S_ISBLK(statbuf.st_mode))
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index 9b1e2b5c3..b109f5ce1 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -20,7 +20,7 @@ int mkswap_main(int argc, char *argv[])
20 20
21 // Figure out how big the device is and announce our intentions. 21 // Figure out how big the device is and announce our intentions.
22 22
23 fd = bb_xopen(argv[1],O_RDWR); 23 fd = xopen(argv[1],O_RDWR);
24 len = fdlength(fd); 24 len = fdlength(fd);
25 pagesize = getpagesize(); 25 pagesize = getpagesize();
26 printf("Setting up swapspace version 1, size = %ld bytes\n", (long)(len-pagesize)); 26 printf("Setting up swapspace version 1, size = %ld bytes\n", (long)(len-pagesize));
diff --git a/util-linux/more.c b/util-linux/more.c
index 2ad1e797c..f68292e80 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -11,28 +11,9 @@
11 * 11 *
12 * Termios corrects by Vladimir Oleynik <dzo@simtreas.ru> 12 * Termios corrects by Vladimir Oleynik <dzo@simtreas.ru>
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify 14 * Licensed under GPLv2 or later, see file License in this tarball for details.
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 */ 15 */
29 16
30#include <stdio.h>
31#include <fcntl.h>
32#include <signal.h>
33#include <stdlib.h>
34#include <unistd.h>
35#include <sys/ioctl.h>
36#include "busybox.h" 17#include "busybox.h"
37 18
38 19
@@ -76,7 +57,7 @@ int more_main(int argc, char **argv)
76 if(isatty(STDOUT_FILENO)) { 57 if(isatty(STDOUT_FILENO)) {
77 cin = fopen(CURRENT_TTY, "r"); 58 cin = fopen(CURRENT_TTY, "r");
78 if (!cin) 59 if (!cin)
79 cin = bb_xfopen(CONSOLE_DEV, "r"); 60 cin = xfopen(CONSOLE_DEV, "r");
80 please_display_more_prompt = 2; 61 please_display_more_prompt = 2;
81#ifdef CONFIG_FEATURE_USE_TERMIOS 62#ifdef CONFIG_FEATURE_USE_TERMIOS
82 cin_fileno = fileno(cin); 63 cin_fileno = fileno(cin);
diff --git a/util-linux/mount.c b/util-linux/mount.c
index c64c3f438..f665a0875 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -23,13 +23,7 @@
23*/ 23*/
24 24
25#include "busybox.h" 25#include "busybox.h"
26#include <unistd.h>
27#include <errno.h>
28#include <string.h>
29#include <mntent.h> 26#include <mntent.h>
30#include <ctype.h>
31#include <fcntl.h> // for CONFIG_FEATURE_MOUNT_LOOP
32#include <sys/ioctl.h> // for CONFIG_FEATURE_MOUNT_LOOP
33 27
34// These two aren't always defined in old headers 28// These two aren't always defined in old headers
35#ifndef MS_BIND 29#ifndef MS_BIND
@@ -89,12 +83,12 @@ struct {
89static void append_mount_options(char **oldopts, char *newopts) 83static void append_mount_options(char **oldopts, char *newopts)
90{ 84{
91 if(*oldopts && **oldopts) { 85 if(*oldopts && **oldopts) {
92 char *temp=bb_xasprintf("%s,%s",*oldopts,newopts); 86 char *temp=xasprintf("%s,%s",*oldopts,newopts);
93 free(*oldopts); 87 free(*oldopts);
94 *oldopts=temp; 88 *oldopts=temp;
95 } else { 89 } else {
96 if (ENABLE_FEATURE_CLEAN_UP) free(*oldopts); 90 if (ENABLE_FEATURE_CLEAN_UP) free(*oldopts);
97 *oldopts = bb_xstrdup(newopts); 91 *oldopts = xstrdup(newopts);
98 } 92 }
99} 93}
100 94
@@ -165,7 +159,7 @@ static llist_t *get_block_backed_filesystems(void)
165 if(*fs=='#' || *fs=='*') continue; 159 if(*fs=='#' || *fs=='*') continue;
166 if(!*fs) continue; 160 if(!*fs) continue;
167 161
168 llist_add_to_end(&list,bb_xstrdup(fs)); 162 llist_add_to_end(&list,xstrdup(fs));
169 } 163 }
170 if (ENABLE_FEATURE_CLEAN_UP) fclose(f); 164 if (ENABLE_FEATURE_CLEAN_UP) fclose(f);
171 } 165 }
@@ -367,7 +361,7 @@ report_error:
367 361
368int mount_main(int argc, char **argv) 362int mount_main(int argc, char **argv)
369{ 363{
370 char *cmdopts = bb_xstrdup(""), *fstabname, *fstype=0, *storage_path=0; 364 char *cmdopts = xstrdup(""), *fstabname, *fstype=0, *storage_path=0;
371 FILE *fstab; 365 FILE *fstab;
372 int i, opt, all = FALSE, rc = 0; 366 int i, opt, all = FALSE, rc = 0;
373 struct mntent mtpair[2], *mtcur = mtpair; 367 struct mntent mtpair[2], *mtcur = mtpair;
@@ -493,7 +487,7 @@ int mount_main(int argc, char **argv)
493 // Mount the last thing we found. 487 // Mount the last thing we found.
494 488
495 mtcur = mtnext; 489 mtcur = mtnext;
496 mtcur->mnt_opts=bb_xstrdup(mtcur->mnt_opts); 490 mtcur->mnt_opts = xstrdup(mtcur->mnt_opts);
497 append_mount_options(&(mtcur->mnt_opts),cmdopts); 491 append_mount_options(&(mtcur->mnt_opts),cmdopts);
498 rc = singlemount(mtcur, 0); 492 rc = singlemount(mtcur, 0);
499 free(mtcur->mnt_opts); 493 free(mtcur->mnt_opts);
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c
index 705975d29..e7d194f0f 100644
--- a/util-linux/nfsmount.c
+++ b/util-linux/nfsmount.c
@@ -26,10 +26,6 @@
26 */ 26 */
27 27
28#include "busybox.h" 28#include "busybox.h"
29#include <unistd.h>
30#include <string.h>
31#include <errno.h>
32#include <time.h>
33#include <sys/utsname.h> 29#include <sys/utsname.h>
34#undef TRUE 30#undef TRUE
35#undef FALSE 31#undef FALSE
@@ -391,7 +387,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
391 } 387 }
392 sprintf(new_opts, "%s%saddr=%s", 388 sprintf(new_opts, "%s%saddr=%s",
393 old_opts, *old_opts ? "," : "", s); 389 old_opts, *old_opts ? "," : "", s);
394 *mount_opts = bb_xstrdup(new_opts); 390 *mount_opts = xstrdup(new_opts);
395 391
396 /* Set default options. 392 /* Set default options.
397 * rsize/wsize (and bsize, for ver >= 3) are left 0 in order to 393 * rsize/wsize (and bsize, for ver >= 3) are left 0 in order to
@@ -459,7 +455,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
459 else if (!strcmp(opt, "mountport")) 455 else if (!strcmp(opt, "mountport"))
460 mountport = val; 456 mountport = val;
461 else if (!strcmp(opt, "mounthost")) 457 else if (!strcmp(opt, "mounthost"))
462 mounthost=bb_xstrndup(opteq+1, 458 mounthost=xstrndup(opteq+1,
463 strcspn(opteq+1," \t\n\r,")); 459 strcspn(opteq+1," \t\n\r,"));
464 else if (!strcmp(opt, "mountprog")) 460 else if (!strcmp(opt, "mountprog"))
465 mountprog = val; 461 mountprog = val;
@@ -729,7 +725,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
729 if (!bg) 725 if (!bg)
730 goto fail; 726 goto fail;
731 if (!running_bg) { 727 if (!running_bg) {
732 prev_bg_host = bb_xstrdup(hostname); 728 prev_bg_host = xstrdup(hostname);
733 if (retry > 0) 729 if (retry > 0)
734 retval = EX_BG; 730 retval = EX_BG;
735 goto fail; 731 goto fail;
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c
index 8fe8787ba..aaa419a3c 100644
--- a/util-linux/readprofile.c
+++ b/util-linux/readprofile.c
@@ -4,19 +4,7 @@
4 * 4 *
5 * Copyright (C) 1994,1996 Alessandro Rubini (rubini@ipvvis.unipv.it) 5 * Copyright (C) 1994,1996 Alessandro Rubini (rubini@ipvvis.unipv.it)
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 8 */
21 9
22/* 10/*
@@ -44,17 +32,8 @@
44 * Paul Mundt <lethal@linux-sh.org>. 32 * Paul Mundt <lethal@linux-sh.org>.
45 */ 33 */
46 34
47#include <errno.h>
48#include <stdio.h>
49#include <fcntl.h>
50#include <stdlib.h>
51#include <unistd.h>
52#include <string.h>
53#include <sys/types.h>
54#include <sys/stat.h>
55#include <sys/utsname.h>
56
57#include "busybox.h" 35#include "busybox.h"
36#include <sys/utsname.h>
58 37
59#define S_LEN 128 38#define S_LEN 128
60 39
@@ -138,7 +117,7 @@ int readprofile_main(int argc, char **argv)
138 to_write = 1; /* sth different from sizeof(int) */ 117 to_write = 1; /* sth different from sizeof(int) */
139 } 118 }
140 119
141 fd = bb_xopen(defaultpro,O_WRONLY); 120 fd = xopen(defaultpro,O_WRONLY);
142 121
143 if (write(fd, &multiplier, to_write) != to_write) 122 if (write(fd, &multiplier, to_write) != to_write)
144 bb_perror_msg_and_die("error writing %s", defaultpro); 123 bb_perror_msg_and_die("error writing %s", defaultpro);
@@ -151,7 +130,7 @@ int readprofile_main(int argc, char **argv)
151 * Use an fd for the profiling buffer, to skip stdio overhead 130 * Use an fd for the profiling buffer, to skip stdio overhead
152 */ 131 */
153 132
154 proFd = bb_xopen(proFile,O_RDONLY); 133 proFd = xopen(proFile,O_RDONLY);
155 134
156 if (((int)(len=lseek(proFd,0,SEEK_END)) < 0) 135 if (((int)(len=lseek(proFd,0,SEEK_END)) < 0)
157 || (lseek(proFd,0,SEEK_SET) < 0)) 136 || (lseek(proFd,0,SEEK_SET) < 0))
@@ -198,7 +177,7 @@ int readprofile_main(int argc, char **argv)
198 177
199 total = 0; 178 total = 0;
200 179
201 map = bb_xfopen(mapFile, "r"); 180 map = xfopen(mapFile, "r");
202 181
203 while (fgets(mapline,S_LEN,map)) { 182 while (fgets(mapline,S_LEN,map)) {
204 if (sscanf(mapline,"%llx %s %s",&fn_add,mode,fn_name) != 3) 183 if (sscanf(mapline,"%llx %s %s",&fn_add,mode,fn_name) != 3)
diff --git a/util-linux/umount.c b/util-linux/umount.c
index b5696f78b..b74b11027 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -66,8 +66,8 @@ int umount_main(int argc, char **argv)
66 } else while (getmntent_r(fp,&me,path,sizeof(path))) { 66 } else while (getmntent_r(fp,&me,path,sizeof(path))) {
67 m = xmalloc(sizeof(struct mtab_list)); 67 m = xmalloc(sizeof(struct mtab_list));
68 m->next = mtl; 68 m->next = mtl;
69 m->device = bb_xstrdup(me.mnt_fsname); 69 m->device = xstrdup(me.mnt_fsname);
70 m->dir = bb_xstrdup(me.mnt_dir); 70 m->dir = xstrdup(me.mnt_dir);
71 mtl = m; 71 mtl = m;
72 } 72 }
73 endmntent(fp); 73 endmntent(fp);