summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2012-05-09 11:13:26 +0200
committerMichal Schmidt <mschmidt@redhat.com>2012-05-09 11:13:26 +0200
commite564a98237817d8c89f7979856a87d3788988742 (patch)
treeac265bb4d74d3acc961ad5d6707c1cb589bd6cb5
parentf6a68149479a0746fe753deba1bfbf26eb13566f (diff)
main: fix assertion failure due to use of ELEMENTSOF on a non-array
-rw-r--r--src/core/main.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/main.c b/src/core/main.c
index d7ce8abdac..be9d0a60e1 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1640,7 +1640,7 @@ finish:
if (reexecute) {
const char **args;
- unsigned i;
+ unsigned i, args_size;
/* Close and disarm the watchdog, so that the new
* instance can reinitialize it, but doesn't get
@@ -1650,7 +1650,8 @@ finish:
if (switch_root)
do_switch_root(switch_root);
- args = newa(const char*, MAX(5, argc+1));
+ args_size = MAX(5, argc+1);
+ args = newa(const char*, args_size);
if (!switch_root_init) {
char sfd[16];
@@ -1673,7 +1674,7 @@ finish:
args[i++] = sfd;
args[i++] = NULL;
- assert(i <= ELEMENTSOF(args));
+ assert(i <= args_size);
execv(args[0], (char* const*) args);
}
@@ -1695,7 +1696,7 @@ finish:
args[i++] = argv[j];
args[i++] = NULL;
- assert(i <= ELEMENTSOF(args));
+ assert(i <= args_size);
execv(args[0], (char* const*) args);
log_error("Failed to reexecute: %m");