1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix some minor code issues all over the place

This commit is contained in:
sfan5 2020-12-23 22:03:49 +01:00
parent 289425f6bd
commit 74762470b2
19 changed files with 45 additions and 109 deletions

View file

@ -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);
}