diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2010-12-17 12:37:49 +0000 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2010-12-17 12:37:49 +0000 |
commit | bebfa29b486bfcd7bbaf7f7f888aadfb5bf9c730 (patch) | |
tree | adbaefeac45bcb738607d23aafba012c5a91974a /daemons/clvmd/clvmd-command.c | |
parent | 22bb69eb99de9350cb978b5b0ee25e40fbd5add9 (diff) | |
download | lvm2-bebfa29b486bfcd7bbaf7f7f888aadfb5bf9c730.tar.gz lvm2-bebfa29b486bfcd7bbaf7f7f888aadfb5bf9c730.tar.xz lvm2-bebfa29b486bfcd7bbaf7f7f888aadfb5bf9c730.zip |
Fix NULL pointer check for *buf
As ternary operator has lower priority then add operation, this check
was not doing what seemed to be expected.
So enclose the test in braces and check for NULL in *buf.
Diffstat (limited to 'daemons/clvmd/clvmd-command.c')
-rw-r--r-- | daemons/clvmd/clvmd-command.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/daemons/clvmd/clvmd-command.c b/daemons/clvmd/clvmd-command.c index 915fcc7e..49f11971 100644 --- a/daemons/clvmd/clvmd-command.c +++ b/daemons/clvmd/clvmd-command.c @@ -168,8 +168,8 @@ int do_command(struct local_client *client, struct clvm_header *msg, int msglen, /* Check the status of the command and return the error text */ if (status) { - *retlen = 1 + (*buf) ? dm_snprintf(*buf, buflen, "%s", - strerror(status)) : -1; + *retlen = 1 + ((*buf) ? dm_snprintf(*buf, buflen, "%s", + strerror(status)) : -1); } return status; |