Commit 8a8ece4a authored by Federico Vaga's avatar Federico Vaga

sw:lib: validate trtl_msg_poll() input

The main reason it prevent a successful calloc that does not allocate
anything which results in: 'errno = 0' and 'return -1' (which is confusing).

Providing invalid inputs is not acceptable
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 3f88bae2
......@@ -1073,6 +1073,10 @@ int trtl_msg_poll(struct polltrtl *trtlp,
struct pollfd *p;
int i, ret;
if (!trtlp || !npolls) {
errno = EINVAL;
return -1;
}
p = calloc(npolls, sizeof(struct pollfd));
if (!p)
return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment