- convert a few xopen3(,,0) into xopen(,). Also peruse the fact that xopen defaults...
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Mon, 11 Sep 2006 16:01:40 +0000 (16:01 -0000)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Mon, 11 Sep 2006 16:01:40 +0000 (16:01 -0000)
  Saves a few bytes:
$ size busybox.old busybox                                text    data     bss     dec     hex filename
 839676    8780  243592 1092048  10a9d0 busybox.old
 839660    8780  243592 1092032  10a9c0 busybox
$ make CC=gcc-4.2-HEAD bloatcheck
function                                             old     new   delta
static.vconfig_main                                  281     279      -2
static.rx_main                                      1076    1074      -2
static.mt_main                                       294     292      -2
static.gzip_main                                     753     751      -2
static.mkfs_minix_main                              4034    4030      -4
static.unzip_main                                   1771    1766      -5
static.crontab_main                                 1513    1507      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-23)             Total: -23 bytes

archival/gzip.c
archival/unzip.c
miscutils/crontab.c
miscutils/mt.c
miscutils/rx.c
networking/vconfig.c
util-linux/mkfs_minix.c

index ad2c24df1eab2e09bb99ee41afae534846ac8ef2..7c18154ff7932a102971dc3c163f6327058c2282 100644 (file)
@@ -1206,7 +1206,7 @@ int gzip_main(int argc, char **argv)
                                inFileNum = STDIN_FILENO;
                                outFileNum = STDOUT_FILENO;
                        } else {
-                               inFileNum = xopen3(argv[i], O_RDONLY, 0);
+                               inFileNum = xopen(argv[i], O_RDONLY);
                                if (fstat(inFileNum, &statBuf) < 0)
                                        bb_perror_msg_and_die("%s", argv[i]);
                                time_stamp = statBuf.st_ctime;
index 709ebf81a8423fab18b7b3eb657f8b110a374af9..1b80aea9f81129f1b41b2eccdc38cd3a77908855 100644 (file)
@@ -333,7 +333,7 @@ int unzip_main(int argc, char **argv)
                        overwrite = o_always;
                case 'y': /* Open file and fall into unzip */
                        unzip_create_leading_dirs(dst_fn);
-                       dst_fd = xopen3(dst_fn, O_WRONLY | O_CREAT | O_TRUNC, 0777);
+                       dst_fd = xopen(dst_fn, O_WRONLY | O_CREAT | O_TRUNC);
                case -1: /* Unzip */
                        if (verbosity == v_normal) {
                                printf("  inflating: %s\n", dst_fn);
index a8e650c60ac94a42b4ebbd37f17f0f88253cfe8a..1acacc6766ac113206c6bf74b50373f670b24dd9 100644 (file)
@@ -266,7 +266,7 @@ static int GetReplaceStream(const char *user, const char *file)
        exit(0);
 
     bb_default_error_retval = 0;
-    fd = xopen3(file, O_RDONLY, 0);
+    fd = xopen(file, O_RDONLY);
     buf[0] = 0;
     write(filedes[1], buf, 1);
     while ((n = read(fd, buf, sizeof(buf))) > 0) {
index f562a91a257a39681b151c7ce8abb92dea34077b..f4a3be739d3a4ca0c27e516a70f812c78ecc2e49 100644 (file)
@@ -101,7 +101,7 @@ int mt_main(int argc, char **argv)
                        break;
        }
 
-       fd = xopen3(file, mode, 0);
+       fd = xopen(file, mode);
 
        switch (code->value) {
                case MTTELL:
index 91606ecd0cc4b0fbc738a1ca258479b6436a76d0..52a76bfd9ca3ac2639ebdd3301b2cf805253b8f5 100644 (file)
@@ -262,7 +262,7 @@ int rx_main(int argc, char **argv)
                        bb_show_usage();
 
        fn = argv[1];
-       ttyfd = xopen3(CURRENT_TTY, O_RDWR, 0);
+       ttyfd = xopen(CURRENT_TTY, O_RDWR);
        filefd = xopen3(fn, O_RDWR|O_CREAT|O_TRUNC, 0666);
 
        if (tcgetattr(ttyfd, &tty) < 0)
index efbb5a1dc6c9c0f93eeb038c4c0b760761b6e280..15a611098ed1a8822b1a1cd69131532bb004b683 100644 (file)
@@ -118,7 +118,7 @@ int vconfig_main(int argc, char **argv)
 
        /* Don't bother closing the filedes.  It will be closed on cleanup. */
        /* Will die if 802.1q is not present */
-       xopen3(conf_file_name, O_RDONLY, 0);
+       xopen(conf_file_name, O_RDONLY);
 
        memset(&ifr, 0, sizeof(struct vlan_ioctl_args));
 
index ed9cb45123a87106a491d5e267c7a9a2208ea5c1..b154f4ab9b0b5ec0babd26195e7fc7764104c086 100644 (file)
@@ -292,7 +292,7 @@ static int get_size(const char *file)
        int fd;
        long size;
 
-       fd = xopen3(file, O_RDWR, 0);
+       fd = xopen(file, O_RDWR);
        if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
                close(fd);
                return (size * 512);
@@ -805,7 +805,7 @@ goodbye:
        tmp += dirsize;
        *(short *) tmp = 2;
        strcpy(tmp + 2, ".badblocks");
-       DEV = xopen3(device_name, O_RDWR, 0);
+       DEV = xopen(device_name, O_RDWR);
        if (fstat(DEV, &statbuf) < 0)
                bb_error_msg_and_die("unable to stat %s", device_name);
        if (!S_ISBLK(statbuf.st_mode))