Skip to content

Commit

Permalink
lxclock: convert to strnprintf()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Feb 26, 2021
1 parent 6ba3f51 commit 272707b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/lxc/lxclock.c
Expand Up @@ -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);
}
Expand Down

0 comments on commit 272707b

Please sign in to comment.