summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarel Zak2019-05-20 13:03:58 +0200
committerKarel Zak2019-05-20 13:03:58 +0200
commit8ecc6ba8079dc7837560182b543cd542c0296cde (patch)
tree29f501a73f9304cf4bf35eb661ce1aa0ea219609 /lib
parentzramctl: use xstrncpy() (diff)
downloadkernel-qcow2-util-linux-8ecc6ba8079dc7837560182b543cd542c0296cde.tar.gz
kernel-qcow2-util-linux-8ecc6ba8079dc7837560182b543cd542c0296cde.tar.xz
kernel-qcow2-util-linux-8ecc6ba8079dc7837560182b543cd542c0296cde.zip
lib/ismounted: use xstrncpy()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/ismounted.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/ismounted.c b/lib/ismounted.c
index 682104d51..fe4c329a7 100644
--- a/lib/ismounted.c
+++ b/lib/ismounted.c
@@ -29,6 +29,7 @@
#endif
#include "pathnames.h"
+#include "strutils.h"
#include "ismounted.h"
#include "c.h"
#ifdef __linux__
@@ -109,7 +110,7 @@ static int check_mntent_file(const char *mtab_file, const char *file,
st_buf.st_dev == file_rdev) {
*mount_flags = MF_MOUNTED;
if (mtpt)
- strncpy(mtpt, "/", mtlen);
+ xstrncpy(mtpt, "/", mtlen);
goto is_root;
}
#endif /* __GNU__ */
@@ -150,7 +151,7 @@ static int check_mntent_file(const char *mtab_file, const char *file,
#endif
if (mtpt)
- strncpy(mtpt, mnt->mnt_dir, mtlen);
+ xstrncpy(mtpt, mnt->mnt_dir, mtlen);
/*
* Check to see if we're referring to the root filesystem.
* If so, do a manual check to see if we can open /etc/mtab
@@ -242,7 +243,7 @@ static int check_getmntinfo(const char *file, int *mount_flags,
++mp;
}
if (mtpt)
- strncpy(mtpt, mp->f_mntonname, mtlen);
+ xstrncpy(mtpt, mp->f_mntonname, mtlen);
return 0;
}
#endif /* HAVE_GETMNTINFO */
@@ -321,7 +322,7 @@ int check_mount_point(const char *device, int *mount_flags,
if (is_swap_device(device)) {
*mount_flags = MF_MOUNTED | MF_SWAP;
if (mtpt && mtlen)
- strncpy(mtpt, "[SWAP]", mtlen);
+ xstrncpy(mtpt, "[SWAP]", mtlen);
} else {
#ifdef HAVE_MNTENT_H
retval = check_mntent(device, mount_flags, mtpt, mtlen);