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
log_warn(LD_CONFIG, "Unable to disable debugger attaching: %s",
strerror(errno));
}
-#endif
++#endif /* defined(TRIED_TO_DISABLE) */
+ #undef TRIED_TO_DISABLE
return r;
}
"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) {
}
*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
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,