mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-09-08 14:42:02 +00:00
Get rid of bash-specific syntax while creating state dir
The system call invokes /bin/sh. So, getting rid of brace expansion syntax while creating the state dir as it may not be supported by /bin/sh
This commit is contained in:
+13
-13
@@ -166,20 +166,14 @@ int create_required_dirs(void)
|
||||
if (missing) { // (re)create dirs
|
||||
char *cmd;
|
||||
|
||||
// laziness here for want of a simple "mkdir -p"
|
||||
string_or_die(&cmd, "mkdir -p %s/{delta,staged,download}", STATE_DIR);
|
||||
ret = system(cmd);
|
||||
if (ret) {
|
||||
return -1;
|
||||
}
|
||||
free(cmd);
|
||||
|
||||
// chmod 700
|
||||
ret = chmod(STATE_DIR, S_IRWXU);
|
||||
if (ret) {
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < STATE_DIR_COUNT; i++) {
|
||||
string_or_die(&cmd, "mkdir -p %s/%s", STATE_DIR, dirs[i]);
|
||||
ret = system(cmd);
|
||||
if (ret) {
|
||||
return -1;
|
||||
}
|
||||
free(cmd);
|
||||
|
||||
string_or_die(&dir, "%s/%s", STATE_DIR, dirs[i]);
|
||||
ret = chmod(dir, S_IRWXU);
|
||||
if (ret) {
|
||||
@@ -187,6 +181,12 @@ int create_required_dirs(void)
|
||||
}
|
||||
free(dir);
|
||||
}
|
||||
|
||||
// chmod 700
|
||||
ret = chmod(STATE_DIR, S_IRWXU);
|
||||
if (ret) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user