diff options
author | Karel Zak | 2012-01-30 23:22:53 +0100 |
---|---|---|
committer | Karel Zak | 2012-01-30 23:22:53 +0100 |
commit | ff7eba4d5ed28ca1f9b9288f1e292c7e7bf49937 (patch) | |
tree | cc9fa45fde8c4eb53f781cba5041d57f5ea17a62 /libmount/src/context.c | |
parent | libmount: fix negative returns [coverity scan] (diff) | |
download | kernel-qcow2-util-linux-ff7eba4d5ed28ca1f9b9288f1e292c7e7bf49937.tar.gz kernel-qcow2-util-linux-ff7eba4d5ed28ca1f9b9288f1e292c7e7bf49937.tar.xz kernel-qcow2-util-linux-ff7eba4d5ed28ca1f9b9288f1e292c7e7bf49937.zip |
libmount: fix possible null dereferencing [coverity scan]
... let's keep Coverity analyzer happy.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context.c')
-rw-r--r-- | libmount/src/context.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libmount/src/context.c b/libmount/src/context.c index 4494ac6c1..2d88dc38e 100644 --- a/libmount/src/context.c +++ b/libmount/src/context.c @@ -1348,7 +1348,9 @@ int mnt_context_prepare_helper(struct libmnt_context *cxt, const char *name, rc = stat(helper, &st); if (rc == -1 && errno == ENOENT && strchr(type, '.')) { /* If type ends with ".subtype" try without it */ - *strrchr(helper, '.') = '\0'; + char *hs = strrchr(helper, '.'); + if (hs) + *hs = '\0'; rc = stat(helper, &st); } |