diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-07-23 03:08:17 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-07-23 03:08:17 +0200 |
commit | 41883be88960e552c72d1e33ece6a74da9d89777 (patch) | |
tree | ad3b388f43eba683d5054fce25f19f3a03b38546 /kms/client | |
parent | bb88c4ee3a99c72bffb5387c9704f27e6aa5d9e4 (diff) |
Proper waitpid NOHANG handling
Diffstat (limited to 'kms/client')
-rw-r--r-- | kms/client/kms_client.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/kms/client/kms_client.c b/kms/client/kms_client.c index aab5b01..f92a222 100644 --- a/kms/client/kms_client.c +++ b/kms/client/kms_client.c @@ -252,11 +252,9 @@ int gsr_kms_client_init(gsr_kms_client *self, const char *card_path) { int status = 0; int wait_result = waitpid(self->kms_server_pid, &status, WNOHANG); if(wait_result != 0) { - fprintf(stderr, "gsr error: gsr_kms_client_init: kms server died or never started, error: %s\n", strerror(errno)); - self->kms_server_pid = -1; - goto err; - } else if(WIFEXITED(status)) { - int exit_code = WEXITSTATUS(status); + int exit_code = -1; + if(WIFEXITED(status)) + exit_code = WEXITSTATUS(status); fprintf(stderr, "gsr error: gsr_kms_client_init: kms server died or never started, exit code: %d\n", exit_code); self->kms_server_pid = -1; if(exit_code != 0) |