[Untested] fixed the compiler/linter options and fixed the corresponding code.

the code fixes have not been tested. some are trivial orthers might be a bit worrying.
This commit is contained in:
Marc
2022-10-05 13:55:04 +02:00
parent 561a2a90b8
commit 635b1adcaf
11 changed files with 40 additions and 35 deletions
+6 -4
View File
@@ -26,10 +26,12 @@ int copy(const char * path, const char * dest, u_int32_t flags) {
return -1;
}
//flags + cp + path + dest
const char * args[flagCount + 4];
char * args[flagCount + 4];
args[0] = "/bin/cp";
args[1] = path;
args[2] = dest;
args[1] = alloca((strlen(path) + 1) * sizeof(char));
strcpy(args[1], path);
args[2] = alloca((strlen(dest) + 1) * sizeof(char));
strcpy(args[2], dest);
int argIndex = 3;
if(flags & CP_LINK) {
@@ -50,7 +52,7 @@ int copy(const char * path, const char * dest, u_int32_t flags) {
int pid = fork();
if(pid == 0) {
//discard the const. since we are in a fork we don't care.
execv("/bin/cp", (char **)args);
execv("/bin/cp", args);
return 0;
} else {
int returnValue;