Fix the pwd and group functions. The bb_ stuff was a leftover from
[oweals/busybox.git] / cp_mv.c
diff --git a/cp_mv.c b/cp_mv.c
index 0b328827633cd28bea696b61a63a57d907b2e1dc..dbd2fddf56dae3e7aa5f844996afcab872125f20 100644 (file)
--- a/cp_mv.c
+++ b/cp_mv.c
@@ -3,7 +3,7 @@
  * Mini `cp' and `mv' implementation for BusyBox.
  *
  *
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000,2001 by Lineo, inc.
  * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
  *
  * Copyright (C) 2000 by BitterSweet Enterprises, LLC. (GPL)
 #include <unistd.h>
 #include <errno.h>
 #include <getopt.h>
+#include <stdlib.h>
 
-#define is_cp 0
-#define is_mv 1
+static const int is_cp = 0;
+static const int is_mv = 1;
 static int         dz_i;               /* index into cp_mv_usage */
 
 static const char *cp_mv_usage[] =     /* .rodata */
@@ -62,7 +63,7 @@ static const char *baseSrcName;
 static int                srcDirFlag;
 static struct stat srcStatBuf;
 
-static char               baseDestName[BUFSIZ + 1];
+static char               *pBaseDestName;
 static size_t     baseDestLen;
 static int                destDirFlag;
 static struct stat destStatBuf;
@@ -104,7 +105,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk)
        const char *srcBasename;
        char       *name;
 
-       strcpy(destName, baseDestName);
+       strcpy(destName, pBaseDestName);
        destLen = strlen(destName);
 
        if (srcDirFlag == TRUE) {
@@ -175,6 +176,8 @@ extern int cp_mv_main(int argc, char **argv)
 {
        volatile int i;
        int c;
+       RESERVE_BB_BUFFER(baseDestName,BUFSIZ + 1);
+       pBaseDestName = baseDestName; /* available globally */
 
        if (*applet_name == 'c' && *(applet_name + 1) == 'p')
                dz_i = is_cp;