commit 76c33f7ff46df47df0cc880595c4d943d50f019b Merge: c1deabd3b a28e239b1 Author: Nick Mathewson nickm@torproject.org Date: Fri Sep 15 16:40:11 2017 -0400
Merge branch 'scan-build-032'
scripts/test/scan-build.sh | 55 +++++++++++++++++++++++++++++++++---------- src/common/buffers.c | 2 ++ src/common/compat.c | 25 ++++++++++---------- src/common/timers.c | 2 +- src/common/util.c | 27 +++++++++++---------- src/or/circuitbuild.c | 6 ++--- src/or/circuitmux.c | 10 ++------ src/or/config.c | 2 ++ src/or/connection.c | 10 ++++---- src/or/directory.c | 12 +++++----- src/or/dirvote.c | 21 +++++++++-------- src/or/parsecommon.c | 1 + src/or/rendservice.c | 18 +++++++------- src/or/routerparse.c | 6 ++--- src/or/statefile.c | 2 -- src/test/bench.c | 1 + src/test/test_addr.c | 2 ++ src/test/test_config.c | 1 + src/test/test_consdiff.c | 19 ++++++++------- src/test/test_crypto.c | 3 +++ src/test/test_dir.c | 6 ++++- src/test/test_hs_client.c | 8 ++++--- src/test/test_hs_common.c | 3 ++- src/test/test_hs_descriptor.c | 1 + src/test/test_hs_intropoint.c | 4 +++- src/test/test_hs_service.c | 16 +++++++++---- src/test/test_options.c | 6 +++++ src/test/test_rendcache.c | 1 + src/test/test_shared_random.c | 2 ++ src/test/test_tortls.c | 1 + src/test/test_util.c | 3 +++ src/tools/tor-gencert.c | 12 ++++++---- 32 files changed, 179 insertions(+), 109 deletions(-)
diff --cc src/common/compat.c index d377c922c,ab117f7c7..ab1fbc64f --- a/src/common/compat.c +++ b/src/common/compat.c @@@ -2242,17 -2239,15 +2240,14 @@@ tor_disable_debugger_attach(void log_debug(LD_CONFIG, "Attemping to disable debugger attachment to Tor for " "unprivileged users."); -#if defined(__linux__) && defined(HAVE_SYS_PRCTL_H) && defined(HAVE_PRCTL) -#ifdef PR_SET_DUMPABLE +#if defined(__linux__) && defined(HAVE_SYS_PRCTL_H) \ + && defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) - attempted = 1; + #define TRIED_TO_DISABLE r = prctl(PR_SET_DUMPABLE, 0); --#endif - #if defined(__APPLE__) && defined(PT_DENY_ATTACH) - if (r < 0) { - attempted = 1; - r = ptrace(PT_DENY_ATTACH, 0, 0, 0); - } - #endif /* defined(__APPLE__) && defined(PT_DENY_ATTACH) */ + #elif defined(__APPLE__) && defined(PT_DENY_ATTACH) -#define TRIED_TO_DISABLE ++#define TRIED_TO_ATTACH + r = ptrace(PT_DENY_ATTACH, 0, 0, 0); -#endif ++#endif /* defined(__linux__) && defined(HAVE_SYS_PRCTL_H) ... || ... */
// XXX: TODO - Mac OS X has dtrace and this may be disabled. // XXX: TODO - Windows probably has something similar @@@ -2264,6 -2260,8 +2260,8 @@@ log_warn(LD_CONFIG, "Unable to disable debugger attaching: %s", strerror(errno)); } -#endif ++#endif /* defined(TRIED_TO_DISABLE) */ + #undef TRIED_TO_DISABLE return r; }
diff --cc src/common/util.c index b262691d7,c8358ea70..bcb1449a1 --- a/src/common/util.c +++ b/src/common/util.c @@@ -4383,11 -4376,11 +4382,11 @@@ tor_spawn_background(const char *const "Cannot find maximum file descriptor, assuming %d", max_fd); } } -#else +#else /* !(defined(_SC_OPEN_MAX)) */ max_fd = DEFAULT_MAX_FD; -#endif +#endif /* defined(_SC_OPEN_MAX) */
- child_state = CHILD_STATE_FORK; + // child_state = CHILD_STATE_FORK;
pid = fork(); if (0 == pid) { @@@ -4540,8 -4535,8 +4541,8 @@@ }
*process_handle_out = process_handle; - return process_handle->status; + return status; -#endif // _WIN32 +#endif /* defined(_WIN32) */ }
/** Destroy all resources allocated by the process handle in diff --cc src/test/test_hs_common.c index 2d63dff25,3cacbab0f..22fed12f1 --- a/src/test/test_hs_common.c +++ b/src/test/test_hs_common.c @@@ -1588,7 -1512,7 +1589,7 @@@ helper_test_hsdir_sync(networkstatus_t tt_int_op(smartlist_len(desc->previous_hsdirs), OP_EQ, 6);
/* 3) Initialize client time */ - now = helper_set_consensus_and_system_time(ns, client_position); - helper_set_consensus_and_system_time(ns, client_between_srv_and_tp); ++ helper_set_consensus_and_system_time(ns, client_position);
cleanup_nodelist(); SMARTLIST_FOREACH(ns->routerstatus_list,