[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [tor/master 4/8] Fix issues in nickm's review of log_from_pipe for bug #1903



Author: Steven Murdoch <Steven.Murdoch@xxxxxxxxxxxx>
Date: Thu, 7 Oct 2010 22:30:40 +0100
Subject: Fix issues in nickm's review of log_from_pipe for bug #1903
Commit: 23e9f362a28f576fb177958d411ebd8c5995500a

- Replace sscanf with tor_sscanf
- Replace use of strstr with equivalent call to strcmpstart
---
 src/common/util.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/common/util.c b/src/common/util.c
index ed870db..ae18cd5 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",
-- 
1.7.1