Skip to content

Commit

Permalink
Merge pull request #64 from containers/rm_cmd_to_argv
Browse files Browse the repository at this point in the history
Remove cmd_to_argv function
  • Loading branch information
rhatdan authored Feb 7, 2024
2 parents 290c09c + b3b92ac commit c3cdf95
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions initoverlayfs-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,32 +296,6 @@ static inline size_t double_array(char*** ptr, size_t size) {
return size;
}

static inline char** cmd_to_argv(char* cmd) {
if (!cmd)
return 0;

size_t size = 16;
char** argv = (char**)malloc(size * sizeof(char*));
if (!argv)
return argv;

size_t i = 0;
static const char* delim = " \f\n\r\t\v";
for (char* token = strtok(cmd, delim); token; token = strtok(NULL, delim)) {
if (i >= size) {
size = double_array(&argv, size);
if (!size)
return argv;
}

argv[i] = token;
++i;
}

argv[i] = 0;
return argv;
}

void wait_mount_bootfs(const conf* c) {
fork_execlp("udevadm", "wait", c->bootfs.val->c_str);

Expand Down

0 comments on commit c3cdf95

Please sign in to comment.