Skip to content

Commit

Permalink
Check lock return values
Browse files Browse the repository at this point in the history
This will inform us when some of the locks fails.
It can help us with debugging OpenSCAP#1199.
  • Loading branch information
jan-cerny committed Oct 3, 2018
1 parent a1f3f68 commit 55c8a99
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/OVAL/probes/SEAP/seap-packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ int SEAP_packet_send (SEAP_CTX_t *ctx, int sd, SEAP_packet_t *packet)
return (-1);
}

if (DESC_WLOCK (dsc)) {
if (DESC_WLOCK(dsc) == 1) {
ret = 0;

if (sch_queue_sendsexp(dsc, packet_sexp, 0) < 0) {
Expand All @@ -875,8 +875,15 @@ int SEAP_packet_send (SEAP_CTX_t *ctx, int sd, SEAP_packet_t *packet)
}
}

DESC_WUNLOCK(dsc);
}
if (DESC_WUNLOCK(dsc) != 1) {
dE("DESC_WUNLOCK failed to unlock a mutex: %s", strerror(errno));
ret = -1;
}
} else {
dE("DESC_WLOCK failed to lock a mutex: %s", strerror(errno));
ret = -1;
}


protect_errno {
SEXP_free (packet_sexp);
Expand Down

0 comments on commit 55c8a99

Please sign in to comment.