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

index 361cde92b4b5138d5839a3135547f4d65efd4bc9..a6a43cef28b1bdcbfff86565b6a3a39ad429217b 100644 (file)
@@ -103,17 +103,17 @@ static char *lxclock_name(const char *p, const char *n)
        if (!dest)
                return NULL;
 
-       ret = snprintf(dest, len, "%s/lxc/lock/%s", rundir, p);
-       if (ret < 0 || (size_t)ret >= len)
-               return ret_set_errno(NULL, EIO);
+       ret = strnprintf(dest, len, "%s/lxc/lock/%s", rundir, p);
+       if (ret < 0)
+               return NULL;
 
        ret = mkdir_p(dest, 0755);
        if (ret < 0)
                return NULL;
 
-       ret = snprintf(dest, len, "%s/lxc/lock/%s/.%s", rundir, p, n);
-       if (ret < 0 || (size_t)ret >= len)
-               return ret_set_errno(NULL, EIO);
+       ret = strnprintf(dest, len, "%s/lxc/lock/%s/.%s", rundir, p, n);
+       if (ret < 0)
+               return NULL;
 
        return move_ptr(dest);
 }