argv[] can't be declared in this way because the initializers are not
computable at compile time. GCC allows this construct, but stricter
compilers don't.
{
struct snapshot *s = snapshot_currently_being_removed;
char *new_name = being_deleted_name(s);
{
struct snapshot *s = snapshot_currently_being_removed;
char *new_name = being_deleted_name(s);
- char *argv[] = {"rm", "-rf", new_name, NULL};
+ argv[0] = "rm";
+ argv[1] = "-rf";
+ argv[2] = new_name;
+ argv[3] = NULL;
+
assert(snapshot_removal_status == HS_PRE_SUCCESS);
assert(remove_pid == 0);
assert(snapshot_removal_status == HS_PRE_SUCCESS);
assert(remove_pid == 0);
static void exit_hook(int exit_code)
{
static void exit_hook(int exit_code)
{
- char *argv[] = {conf.exit_hook_arg, dss_strerror(-exit_code), NULL};
+ argv[0] = conf.exit_hook_arg;
+ argv[1] = dss_strerror(-exit_code);
+ argv[2] = NULL;
+
DSS_NOTICE_LOG("executing %s %s\n", argv[0], argv[1]);
dss_exec(&pid, conf.exit_hook_arg, argv);
}
DSS_NOTICE_LOG("executing %s %s\n", argv[0], argv[1]);
dss_exec(&pid, conf.exit_hook_arg, argv);
}