From 23e9f362a28f576fb177958d411ebd8c5995500a Mon Sep 17 00:00:00 2001 From: Steven Murdoch Date: Thu, 7 Oct 2010 22:30:40 +0100 Subject: [PATCH] Fix issues in nickm's review of log_from_pipe for bug #1903 - Replace sscanf with tor_sscanf - Replace use of strstr with equivalent call to strcmpstart --- src/common/util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/util.c b/src/common/util.c index ed870db5d5..ae18cd5525 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -3177,11 +3177,11 @@ log_from_pipe(FILE *stream, int severity, const char *executable, } /* Check if buf starts with SPAWN_ERROR_MESSAGE */ - if (strstr(buf, SPAWN_ERROR_MESSAGE) == buf) { + if (strcmpstart(buf, SPAWN_ERROR_MESSAGE) == 0) { /* Parse error message */ int retval, child_state, saved_errno; - retval = sscanf(buf, SPAWN_ERROR_MESSAGE "%d/%d", - &child_state, &saved_errno); + retval = tor_sscanf(buf, SPAWN_ERROR_MESSAGE "%x/%x", + &child_state, &saved_errno); if (retval == 2) { log_warn(LD_GENERAL, "Failed to start child process \"%s\" in state %d: %s",