Set permissions of created file
[oweals/busybox.git] / cp_mv.c
diff --git a/cp_mv.c b/cp_mv.c
index 8052b41a6af2b162eab9112f38976104c148af3e..3c19f1a0495bcb1f6b1989ee140ae480a0f254cf 100644 (file)
--- a/cp_mv.c
+++ b/cp_mv.c
  *
  */
 
-#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_name_too_long
-#define bb_need_omitting_directory
-#define bb_need_not_a_directory
-#include "messages.c"
-
 #include <stdio.h>
 #include <time.h>
 #include <utime.h>
 #include <errno.h>
 #include <getopt.h>
 #include <stdlib.h>
+#include "busybox.h"
+#define BB_DECLARE_EXTERN
+#define bb_need_name_too_long
+#define bb_need_omitting_directory
+#define bb_need_not_a_directory
+#include "messages.c"
+
 
 static const int is_cp = 0;
 static const int is_mv = 1;
@@ -147,7 +147,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk)
                        add_to_ino_dev_hashtable(statbuf, destName);
                }
        }
-       return copy_file(fileName, destName, preserveFlag, followLinks, forceFlag);
+       return copy_file(fileName, destName, preserveFlag, followLinks, forceFlag, FALSE);
 }
 
 static int
@@ -256,18 +256,16 @@ extern int cp_mv_main(int argc, char **argv)
                        int                     state = 0;
                        char            *pushd, *d, *p;
 
-                       if ((pushd = getcwd(NULL, BUFSIZ + 1)) == NULL) {
-                               perror_msg("getcwd()");
+                       if ((pushd = xgetcwd(0)) == NULL)
                                continue;
-                       }
+
                        if (chdir(baseDestName) < 0) {
                                perror_msg("chdir(%s)", baseSrcName);
                                continue;
                        }
-                       if ((d = getcwd(NULL, BUFSIZ + 1)) == NULL) {
-                               perror_msg("getcwd()");
+                       if ((d = xgetcwd(0)) == NULL)
                                continue;
-                       }
+
                        while (!state && *d != '\0') {
                                if (stat(d, &sb) < 0) { /* stat not lstat - always dereference targets */
                                        perror_msg("stat(%s)", d);