*: replace xopen3 with xopen where makes sense
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 18 Oct 2010 00:38:27 +0000 (02:38 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 18 Oct 2010 00:38:27 +0000 (02:38 +0200)
function                                             old     new   delta
uniq_main                                            421     416      -5
sort_main                                            803     798      -5
patch_main                                          2051    2046      -5
cpio_main                                            547     542      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
archival/cpio.c
coreutils/sort.c
coreutils/uniq.c
editors/patch.c
editors/patch_toybox.c
libbb/xfuncs_printf.c

index 7cd8ee8a7e5414d7974c10ffba5edf0877e007e7..a2d74dc79548423a2941ffcd05783b2c0a267da6 100644 (file)
@@ -370,7 +370,7 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
                if (cpio_fmt[0] != 'n') /* we _require_ "-H newc" */
                        bb_show_usage();
                if (opt & CPIO_OPT_FILE) {
-                       xmove_fd(xopen3(cpio_filename, O_WRONLY | O_CREAT | O_TRUNC, 0666), STDOUT_FILENO);
+                       xmove_fd(xopen(cpio_filename, O_WRONLY | O_CREAT | O_TRUNC), STDOUT_FILENO);
                }
  dump:
                return cpio_o();
index 4407b71055a79c8be33f803b266e9a47e2994657..7168243217e56e0078e7db1e90c4fc28d383a4d5 100644 (file)
@@ -412,7 +412,7 @@ int sort_main(int argc UNUSED_PARAM, char **argv)
 #if ENABLE_FEATURE_SORT_BIG
        /* Open output file _after_ we read all input ones */
        if (option_mask32 & FLAG_o)
-               xmove_fd(xopen3(str_o, O_WRONLY, 0666), STDOUT_FILENO);
+               xmove_fd(xopen(str_o, O_WRONLY), STDOUT_FILENO);
 #endif
        flag = (option_mask32 & FLAG_z) ? '\0' : '\n';
        for (i = 0; i < linecount; i++)
index f0364b9a1cf18cc64d8ed3df166219e9f5b61d6d..358de789490e14f613394c3da952c664a043c3cb 100644 (file)
@@ -52,8 +52,8 @@ int uniq_main(int argc UNUSED_PARAM, char **argv)
                        if (output[0] != '-' || output[1]) {
                                // Won't work with "uniq - FILE" and closed stdin:
                                //close(STDOUT_FILENO);
-                               //xopen3(output, O_WRONLY | O_CREAT | O_TRUNC, 0666);
-                               xmove_fd(xopen3(output, O_WRONLY | O_CREAT | O_TRUNC, 0666), STDOUT_FILENO);
+                               //xopen(output, O_WRONLY | O_CREAT | O_TRUNC);
+                               xmove_fd(xopen(output, O_WRONLY | O_CREAT | O_TRUNC), STDOUT_FILENO);
                        }
                }
        }
index 764f0f18317f0c00293b9d2e69f5c281baa2978d..66a9474fed3df9a2ab5a438a32523caea33f80fe 100644 (file)
@@ -591,7 +591,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
                                                        xmkpath(name, -1);
                                                        *s = '/';
                                                }
-                                               TT.filein = xopen3(name, O_CREAT|O_EXCL|O_RDWR, 0666);
+                                               TT.filein = xopen(name, O_CREAT|O_EXCL|O_RDWR);
                                        } else {
                                                printf("patching file %s\n", name);
                                                TT.filein = xopen(name, O_RDONLY);
index 04bd98eead9d36db5a8e4bec228d17f5ee5a09de..a60bf070fc4a74db08c76245c0ffb9ebf09a64ec 100644 (file)
@@ -559,7 +559,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
                                                        xmkpath(name, -1);
                                                        *s = '/';
                                                }
-                                               TT.filein = xopen3(name, O_CREAT|O_EXCL|O_RDWR, 0666);
+                                               TT.filein = xopen(name, O_CREAT|O_EXCL|O_RDWR);
                                        } else {
                                                printf("patching file %s\n", name);
                                                TT.filein = xopen(name, O_RDWR);
index c6db38d3375d07b1dc05a27ceffb4fd798bf1f6a..ba660a2dbf2497df04316f121716313035d2db44 100644 (file)
@@ -134,7 +134,7 @@ int FAST_FUNC xopen3(const char *pathname, int flags, int mode)
        return ret;
 }
 
-// Die if we can't open an existing file and return a fd.
+// Die if we can't open a file and return a fd.
 int FAST_FUNC xopen(const char *pathname, int flags)
 {
        return xopen3(pathname, flags, 0666);