summaryrefslogtreecommitdiffstats
path: root/libmount/src/context.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmount/src/context.c')
-rw-r--r--libmount/src/context.c4
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);
}