HomeClusterLabs Projects

mainloop: fix potential segfault for fd = 0

Description

mainloop: fix potential segfault for fd = 0

Some monitoring software may explicitly *close* stdin,
(not just redirect from /dev/null).

That led to segfault, because the next allocated new fd would be 0,
mainloop_add_fd would return NULL (and the caller would not check).

Reproduce:
crm_mon -1 <&-

Since 0 is a legal value for fd, allow it in mainloop_add_fd, too.

Details

Provenance
Lars Ellenberg <lars.ellenberg@linbit.com>Authored on Oct 2 2014, 11:23 AM
Parents
rPbe1e835e8129: Merge branch 'master' of github.com:ClusterLabs/pacemaker
Branches
Unknown
Tags
Unknown

Event Timeline