chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f6a6814
)
main: fix assertion failure due to use of ELEMENTSOF on a non-array
author
Michal Schmidt
<mschmidt@redhat.com>
Wed, 9 May 2012 09:13:26 +0000
(11:13 +0200)
committer
Michal Schmidt
<mschmidt@redhat.com>
Wed, 9 May 2012 09:13:26 +0000
(11:13 +0200)
src/core/main.c
patch
|
blob
|
history
diff --git
a/src/core/main.c
b/src/core/main.c
index d7ce8abdac895e907ceed40f9cdc75b603239668..be9d0a60e1ce49d11f8eebba2d834b038d406bea 100644
(file)
--- a/
src/core/main.c
+++ b/
src/core/main.c
@@
-1640,7
+1640,7
@@
finish:
if (reexecute) {
const char **args;
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
/* 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);
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];
if (!switch_root_init) {
char sfd[16];
@@
-1673,7
+1674,7
@@
finish:
args[i++] = sfd;
args[i++] = NULL;
args[i++] = sfd;
args[i++] = NULL;
- assert(i <=
ELEMENTSOF(args)
);
+ assert(i <=
args_size
);
execv(args[0], (char* const*) args);
}
execv(args[0], (char* const*) args);
}
@@
-1695,7
+1696,7
@@
finish:
args[i++] = argv[j];
args[i++] = NULL;
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");
execv(args[0], (char* const*) args);
log_error("Failed to reexecute: %m");