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

index e2a3837f9c5dd2b4fc7bcd2ff8dbe5c73f5d0e39..e046c2dd0040c5598d2af877a8b66151418c83e0 100644 (file)
@@ -617,8 +617,8 @@ int timens_offset_write(clockid_t clk_id, int64_t s_offset, int64_t ns_offset)
        if (fd < 0)
                return -errno;
 
-       len = snprintf(buf, sizeof(buf), "%d %" PRId64 " %" PRId64, clk_id, s_offset, ns_offset);
-       if (len < 0 || len >= sizeof(buf))
+       len = strnprintf(buf, sizeof(buf), "%d %" PRId64 " %" PRId64, clk_id, s_offset, ns_offset);
+       if (len < 0)
                return ret_errno(EFBIG);
 
        ret = lxc_write_nointr(fd, buf, len);