From df38cbc7b0f06bccb45135e621232f0d287aa5b2 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 4 Nov 2010 18:15:30 +0100 Subject: fix a simple bug in run_event() - was truncating command at first word Signed-off-by: Denys Vlasenko --- lib/utils/run_event.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/utils') diff --git a/lib/utils/run_event.c b/lib/utils/run_event.c index e89d1040..45e4bf86 100644 --- a/lib/utils/run_event.c +++ b/lib/utils/run_event.c @@ -57,13 +57,16 @@ int run_event(struct run_event_state *state, { char *end_word = skip_non_whitespace(p); char *next_word = skip_whitespace(end_word); - *end_word = '\0'; + + /* *end_word = '\0'; - BUG, truncates command */ /* If there is no '=' in this word... */ char *line_val = strchr(p, '='); - if (!line_val) + if (!line_val || line_val >= end_word) break; /* ...we found the start of a command */ + *end_word = '\0'; + /* Current word has VAR=VAL form. line_val => VAL */ *line_val++ = '\0'; -- cgit