mirror of
https://github.com/HowardHinnant/date.git
synced 2026-08-03 20:14:08 +02:00
fix: add quotes to all tar invocations via std::system (#909)
This commit is contained in:
+4
-4
@@ -3309,7 +3309,7 @@ remove_folder_and_subfolders(const std::string& folder)
|
||||
# endif // !USE_SHELL_API
|
||||
# else // !_WIN32
|
||||
# if USE_SHELL_API
|
||||
return std::system(("rm -R " + folder).c_str()) == EXIT_SUCCESS;
|
||||
return std::system(("rm -R \"" + folder + "\"").c_str()) == EXIT_SUCCESS;
|
||||
# else // !USE_SHELL_API
|
||||
struct dir_deleter {
|
||||
dir_deleter() {}
|
||||
@@ -3375,7 +3375,7 @@ make_directory(const std::string& folder)
|
||||
# endif // !USE_SHELL_API
|
||||
# else // !_WIN32
|
||||
# if USE_SHELL_API
|
||||
return std::system(("mkdir -p " + folder).c_str()) == EXIT_SUCCESS;
|
||||
return std::system(("mkdir -p \"" + folder + "\"").c_str()) == EXIT_SUCCESS;
|
||||
# else // !USE_SHELL_API
|
||||
return mkdir(folder.c_str(), 0777) == 0;
|
||||
# endif // !USE_SHELL_API
|
||||
@@ -3397,7 +3397,7 @@ delete_file(const std::string& file)
|
||||
# endif // !USE_SHELL_API
|
||||
# else // !_WIN32
|
||||
# if USE_SHELL_API
|
||||
return std::system(("rm " + file).c_str()) == EXIT_SUCCESS;
|
||||
return std::system(("rm \"" + file + "\"").c_str()) == EXIT_SUCCESS;
|
||||
# else // !USE_SHELL_API
|
||||
return unlink(file.c_str()) == 0;
|
||||
# endif // !USE_SHELL_API
|
||||
@@ -3632,7 +3632,7 @@ bool
|
||||
extract_gz_file(const std::string&, const std::string& gz_file, const std::string&)
|
||||
{
|
||||
# if USE_SHELL_API
|
||||
bool unzipped = std::system(("tar -xzf " + gz_file + " -C " + get_install()).c_str()) == EXIT_SUCCESS;
|
||||
bool unzipped = std::system(("tar -xzf \"" + gz_file + "\" -C \"" + get_install() + "\"").c_str()) == EXIT_SUCCESS;
|
||||
# else // !USE_SHELL_API
|
||||
const char prog[] = {"/usr/bin/tar"};
|
||||
const char*const args[] =
|
||||
|
||||
Reference in New Issue
Block a user