Skip to content

Commit 55c8a99

Browse files
committed
Check lock return values
This will inform us when some of the locks fails. It can help us with debugging #1199.
1 parent a1f3f68 commit 55c8a99

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/OVAL/probes/SEAP/seap-packet.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ int SEAP_packet_send (SEAP_CTX_t *ctx, int sd, SEAP_packet_t *packet)
864864
return (-1);
865865
}
866866

867-
if (DESC_WLOCK (dsc)) {
867+
if (DESC_WLOCK(dsc) == 1) {
868868
ret = 0;
869869

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

878-
DESC_WUNLOCK(dsc);
879-
}
878+
if (DESC_WUNLOCK(dsc) != 1) {
879+
dE("DESC_WUNLOCK failed to unlock a mutex: %s", strerror(errno));
880+
ret = -1;
881+
}
882+
} else {
883+
dE("DESC_WLOCK failed to lock a mutex: %s", strerror(errno));
884+
ret = -1;
885+
}
886+
880887

881888
protect_errno {
882889
SEXP_free (packet_sexp);

0 commit comments

Comments
 (0)