From: Christian Brauner Date: Wed, 20 Jun 2018 15:53:19 +0000 (+0200) Subject: btrfs: s/strncat()/strlcat()/g X-Git-Tag: lxc-4.0.0~582^2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=3afafe55cc897f86b850795be630add1e277b164;p=mirror_lxc.git btrfs: s/strncat()/strlcat()/g Signed-off-by: Christian Brauner --- diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am index 99b5291d1..313475824 100644 --- a/src/lxc/Makefile.am +++ b/src/lxc/Makefile.am @@ -159,6 +159,10 @@ if !HAVE_STRLCPY liblxc_la_SOURCES += ../include/strlcpy.c ../include/strlcpy.h endif +if !HAVE_STRLCAT +liblxc_la_SOURCES += ../include/strlcat.c ../include/strlcat.h +endif + if !HAVE_GETGRGID_R liblxc_la_SOURCES += ../include/getgrgid_r.c ../include/getgrgid_r.h endif @@ -316,6 +320,10 @@ if !HAVE_STRLCPY init_lxc_static_SOURCES += ../include/strlcpy.c ../include/strlcpy.h endif +if !HAVE_STRLCAT +init_lxc_static_SOURCES += ../include/strlcat.c ../include/strlcat.h +endif + if !HAVE_GETGRGID_R liblxc_la_SOURCES += ../include/getgrgid_r.c ../include/getgrgid_r.h endif diff --git a/src/lxc/storage/btrfs.c b/src/lxc/storage/btrfs.c index 3458b1f65..c83ddf4e8 100644 --- a/src/lxc/storage/btrfs.c +++ b/src/lxc/storage/btrfs.c @@ -46,6 +46,10 @@ #include "include/strlcpy.h" #endif +#ifndef HAVE_STRLCAT +#include "include/strlcat.h" +#endif + lxc_log_define(btrfs, lxc); /* @@ -89,8 +93,8 @@ char *get_btrfs_subvol_path(int fd, u64 dir_id, u64 objid, char *name, if (!retpath) return NULL; (void)strlcpy(retpath, args.name, len); - strncat(retpath, "/", 1); - strncat(retpath, name, name_len); + (void)strlcat(retpath, "/", 1); + (void)strlcat(retpath, name, name_len); } else { /* we're at the root of ref_tree */ len = name_len + 1; @@ -98,7 +102,7 @@ char *get_btrfs_subvol_path(int fd, u64 dir_id, u64 objid, char *name, if (!retpath) return NULL; *retpath = '\0'; - strncat(retpath, name, name_len); + (void)strlcat(retpath, name, name_len); } return retpath; }