diff options
Diffstat (limited to 'src/filesys.cpp')
-rw-r--r-- | src/filesys.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/filesys.cpp b/src/filesys.cpp index 2470b1b64..28a33f4d0 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -295,31 +295,26 @@ bool RecursiveDelete(const std::string &path) infostream<<"Removing \""<<path<<"\""<<std::endl; - //return false; - pid_t child_pid = fork(); if(child_pid == 0) { // Child - char argv_data[3][10000]; + const char *argv[4] = { #ifdef __ANDROID__ - strcpy(argv_data[0], "/system/bin/rm"); + "/system/bin/rm", #else - strcpy(argv_data[0], "/bin/rm"); + "/bin/rm", #endif - strcpy(argv_data[1], "-rf"); - strncpy(argv_data[2], path.c_str(), sizeof(argv_data[2]) - 1); - char *argv[4]; - argv[0] = argv_data[0]; - argv[1] = argv_data[1]; - argv[2] = argv_data[2]; - argv[3] = NULL; + "-rf", + path.c_str(), + NULL + }; verbosestream<<"Executing '"<<argv[0]<<"' '"<<argv[1]<<"' '" <<argv[2]<<"'"<<std::endl; - execv(argv[0], argv); + execv(argv[0], const_cast<char**>(argv)); // Execv shouldn't return. Failed. _exit(1); @@ -331,7 +326,6 @@ bool RecursiveDelete(const std::string &path) pid_t tpid; do{ tpid = wait(&child_status); - //if(tpid != child_pid) process_terminated(tpid); }while(tpid != child_pid); return (child_status == 0); } |