IPC: merge common code into new function
IPC: merge common code into new function

This also fixes a regression caused by:
42c92fb675a29bb1ec9f718c17daede82d5de3e2

Signed-off-by: Angus Salkeld <86b65304d27d8de73dd7d624c33df7e088f8d94b@redhat.com>

rubenk/libqb,ClusterLabs/libqb,davidvossel/libqb,kgaillot/libqb,gao-yan/libqb,ClusterLabs/libqb,kgaillot/libqb,rubenk/libqb,gao-yan/libqb,davidvossel/libqb,kgaillot/libqb,ClusterLabs/libqb