]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
mount_utils: convert to strnprintf()
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 11 Feb 2021 09:42:22 +0000 (10:42 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 11 Feb 2021 09:42:22 +0000 (10:42 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/mount_utils.c

index d47cbe65579b4785bf154a77253f1a0e6526857a..5132ea226e1137ee9c7bb7aec866058a737fd6d7 100644 (file)
@@ -138,8 +138,8 @@ static int __fs_prepare(const char *fs_name, int fd_from)
         * only use fds for mount.
         */
        if (fd_from >= 0) {
-               ret = snprintf(source, sizeof(source), "/proc/self/fd/%d", fd_from);
-               if (ret < 0 || ret >= sizeof(source))
+               ret = strnprintf(source, sizeof(source), "/proc/self/fd/%d", fd_from);
+               if (ret < 0)
                        return log_error_errno(-EIO, EIO, "Failed to create /proc/self/fd/%d", fd_from);
        }