]> git.tue.mpg.de Git - dss.git/commitdiff
dss.c: Fix initialization of argv[].
authorDaniel Richard G <skunk@iSKUNK.ORG>
Thu, 2 Aug 2012 17:45:38 +0000 (19:45 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 4 Aug 2012 11:07:27 +0000 (13:07 +0200)
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.

dss.c

diff --git a/dss.c b/dss.c
index b18be4d190f2faa29f5c0199dc0be65997a68b7e..7c8b54fc6a0502d0a2ab983b5bc8ff3d33e0bda2 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -324,9 +324,14 @@ static int exec_rm(void)
 {
        struct snapshot *s = snapshot_currently_being_removed;
        char *new_name = being_deleted_name(s);
-       char *argv[] = {"rm", "-rf", new_name, NULL};
+       char *argv[4];
        int ret;
 
+       argv[0] = "rm";
+       argv[1] = "-rf";
+       argv[2] = new_name;
+       argv[3] = NULL;
+
        assert(snapshot_removal_status == HS_PRE_SUCCESS);
        assert(remove_pid == 0);
 
@@ -1215,9 +1220,13 @@ out:
 
 static void exit_hook(int exit_code)
 {
-       char *argv[] = {conf.exit_hook_arg, dss_strerror(-exit_code), NULL};
+       char *argv[3];
        pid_t pid;
 
+       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);
 }