maintenance: compare output of pthread functions for inequality with 0

The documentation for pthread_create and pthread_sigmask state that: "On success, pthread_create() returns 0; on error, it returns an error number" As such, we ought to check for an error by seeing if the output is not 0. Checking for "less than" is a mistake as the error code numbers can be greater than 0. Signed-off-by: Seija <doremylover123@gmail.com> Acked-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Seija committed Dec 2, 2022 at 17:02 UTC 786e67611d46cd761e1aaa73f85b62f3dda1960a
2 files changed +3 -3
builtin/fsmonitor--daemon.c
+2 -2
@@ -1208,7 +1208,7 @@ static int fsmonitor_run_daemon_1(struct fsmonitor_daemon_state *state)
1208 * events.
1209 */
1210 if (pthread_create(&state->listener_thread, NULL,
1211 - fsm_listen__thread_proc, state) < 0) {
1211 + fsm_listen__thread_proc, state)) {
1212 ipc_server_stop_async(state->ipc_server_data);
1213 err = error(_("could not start fsmonitor listener thread"));
1214 goto cleanup;
@@ -1219,7 +1219,7 @@ static int fsmonitor_run_daemon_1(struct fsmonitor_daemon_state *state)
1219 * Start the health thread to watch over our process.
1220 */
1221 if (pthread_create(&state->health_thread, NULL,
1222 - fsm_health__thread_proc, state) < 0) {
1222 + fsm_health__thread_proc, state)) {
1223 ipc_server_stop_async(state->ipc_server_data);
1224 err = error(_("could not start fsmonitor health thread"));
1225 goto cleanup;
run-command.c
+1 -1
@@ -1054,7 +1054,7 @@ static void *run_thread(void *data)
1054 sigset_t mask;
1055 sigemptyset(&mask);
1056 sigaddset(&mask, SIGPIPE);
1057 - if (pthread_sigmask(SIG_BLOCK, &mask, NULL) < 0) {
1057 + if (pthread_sigmask(SIG_BLOCK, &mask, NULL)) {
1058 ret = error("unable to block SIGPIPE in async thread");
1059 return (void *)ret;
1060 }