summaryrefslogtreecommitdiffstats
path: root/cpio/test/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpio/test/main.c')
-rw-r--r--cpio/test/main.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/cpio/test/main.c b/cpio/test/main.c
index a0c5295..0e04059 100644
--- a/cpio/test/main.c
+++ b/cpio/test/main.c
@@ -2289,7 +2289,15 @@ main(int argc, char **argv)
j++;
}
testprogdir[i] = '\0';
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ if (testprogdir[0] != '/' && testprogdir[0] != '\\' &&
+ !(((testprogdir[0] >= 'a' && testprogdir[0] <= 'z') ||
+ (testprogdir[0] >= 'A' && testprogdir[0] <= 'Z')) &&
+ testprogdir[1] == ':' &&
+ (testprogdir[2] == '/' || testprogdir[2] == '\\')))
+#else
if (testprogdir[0] != '/')
+#endif
{
/* Fixup path for relative directories. */
if ((testprogdir = (char *)realloc(testprogdir,
@@ -2298,8 +2306,9 @@ main(int argc, char **argv)
fprintf(stderr, "ERROR: Out of memory.");
exit(1);
}
- strcpy(testprogdir + strlen(pwd) + 1, testprogdir);
- strcpy(testprogdir, pwd);
+ memmove(testprogdir + strlen(pwd) + 1, testprogdir,
+ strlen(testprogdir));
+ memcpy(testprogdir, pwd, strlen(pwd));
testprogdir[strlen(pwd)] = '/';
}
OpenPOWER on IntegriCloud