Previously, when the connect() call in (sd-buscntr) failed, we returned
-EPROTO without ever reading the actual errno from the error pipe. To fix
the issue, delay checking the process exit status until after we've read
and processed any error from the error pipe.
r = wait_for_terminate_and_check("(sd-buscntrns)", child, 0);
if (r < 0)
return r;
- if (r != EXIT_SUCCESS)
- return -EPROTO;
+ bool nonzero_exit_status = r != EXIT_SUCCESS;
n = read(pair[0], &error_buf, sizeof(error_buf));
if (n < 0)
return log_debug_errno(error_buf, "Got error from (sd-buscntr): %m");
}
+ if (nonzero_exit_status)
+ return -EPROTO;
+
return bus_socket_start_auth(b);
}