diff options
author | Benjamin Marzinski <bmarzins@redhat.com> | 2009-08-03 16:59:05 -0500 |
---|---|---|
committer | Christophe Varoqui <christophe.varoqui@free.fr> | 2009-08-04 23:34:07 +0200 |
commit | ee310d71b514b0722f0ec136e3747224ac0596cf (patch) | |
tree | 2915e273e415e3e1a5832a361f24020e492f30a7 /libmultipath | |
parent | f30ea8e7b45c4b65ca654253cc90c29b90f394ab (diff) | |
download | multipath-tools-ee310d71b514b0722f0ec136e3747224ac0596cf.tar.gz multipath-tools-ee310d71b514b0722f0ec136e3747224ac0596cf.tar.bz2 multipath-tools-ee310d71b514b0722f0ec136e3747224ac0596cf.zip |
multipath-tools: Fix uevent handling code
Multipathd wasn't setting buflen when it read in a uevent message. This was
causing buflen to be used unitialized, and would often keep multipathd from
processing uevents. This patch correctly initializes buflen to the size of the
buffer received.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Diffstat (limited to 'libmultipath')
-rw-r--r-- | libmultipath/uevent.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c index 0ed7e12..50ed9c9 100644 --- a/libmultipath/uevent.c +++ b/libmultipath/uevent.c @@ -231,7 +231,8 @@ int uevent_listen(int (*uev_trigger)(struct uevent *, void * trigger_data), smsg.msg_control = cred_msg; smsg.msg_controllen = sizeof(cred_msg); - if (recvmsg(sock, &smsg, 0) < 0) { + buflen = recvmsg(sock, &smsg, 0); + if (buflen < 0) { if (errno != EINTR) condlog(0, "error receiving message"); continue; @@ -286,8 +287,10 @@ int uevent_listen(int (*uev_trigger)(struct uevent *, void * trigger_data), /* action string */ uev->action = buffer; pos = strchr(buffer, '@'); - if (!pos) + if (!pos) { + condlog(3, "bad action string '%s'", buffer); continue; + } pos[0] = '\0'; /* sysfs path */ |