sd-bus: Return detailed (sd-buscntr) error from bus_container_connect_socket()
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.
This commit is contained in:
@@ -75,8 +75,7 @@ int bus_container_connect_socket(sd_bus *b) {
|
||||
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)
|
||||
@@ -98,5 +97,8 @@ int bus_container_connect_socket(sd_bus *b) {
|
||||
return log_debug_errno(error_buf, "Got error from (sd-buscntr): %m");
|
||||
}
|
||||
|
||||
if (nonzero_exit_status)
|
||||
return -EPROTO;
|
||||
|
||||
return bus_socket_start_auth(b);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user