summaryrefslogtreecommitdiffstats
path: root/lib/ismounted.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ismounted.c')
-rw-r--r--lib/ismounted.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ismounted.c b/lib/ismounted.c
index 2463f3356..8a882b27e 100644
--- a/lib/ismounted.c
+++ b/lib/ismounted.c
@@ -317,7 +317,8 @@ int check_mount_point(const char *device, int *mount_flags,
if (is_swap_device(device)) {
*mount_flags = MF_MOUNTED | MF_SWAP;
- strncpy(mtpt, "<swap>", mtlen);
+ if (mtpt && mtlen)
+ strncpy(mtpt, "<swap>", mtlen);
} else {
#ifdef HAVE_MNTENT_H
retval = check_mntent(device, mount_flags, mtpt, mtlen);