sys: Runs rm -rf using run_command()

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit is contained in:
Otavio Pontes
2018-12-06 14:50:18 -08:00
parent 0f793b8a4b
commit ac7bc2a94a
3 changed files with 8 additions and 4 deletions
+1 -4
View File
@@ -40,16 +40,13 @@
static int create_staging_renamedir(char *rename_tmpdir)
{
int ret;
char *rmcommand = NULL;
string_or_die(&rmcommand, "rm -fr %s", rename_tmpdir);
if (!system(rmcommand)) {
if (rm_rf(rename_tmpdir) != 0) {
/* Not fatal but pretty scary, likely to really fail at the
* next command too. Pass for now as printing may just cause
* confusion */
;
}
free_string(&rmcommand);
ret = mkdir(rename_tmpdir, S_IRWXU);
if (ret == -1 && errno != EEXIST) {
+5
View File
@@ -152,3 +152,8 @@ int mkdir_p(const char *dir)
{
return run_command_quiet("/bin/mkdir", "-p", dir, NULL);
}
int rm_rf(const char *file)
{
return run_command_quiet("/bin/rm", "-rf", file, NULL);
}
+2
View File
@@ -40,6 +40,8 @@ int copy(const char *src, const char *dst);
int mkdir_p(const char *dir);
int rm_rf(const char *file);
#ifdef __cplusplus
}
#endif