lxclock: convert to strnprintf()

parent 6ba3f517
...@@ -103,17 +103,17 @@ static char *lxclock_name(const char *p, const char *n) ...@@ -103,17 +103,17 @@ static char *lxclock_name(const char *p, const char *n)
if (!dest) if (!dest)
return NULL; return NULL;
ret = snprintf(dest, len, "%s/lxc/lock/%s", rundir, p); ret = strnprintf(dest, len, "%s/lxc/lock/%s", rundir, p);
if (ret < 0 || (size_t)ret >= len) if (ret < 0)
return ret_set_errno(NULL, EIO); return NULL;
ret = mkdir_p(dest, 0755); ret = mkdir_p(dest, 0755);
if (ret < 0) if (ret < 0)
return NULL; return NULL;
ret = snprintf(dest, len, "%s/lxc/lock/%s/.%s", rundir, p, n); ret = strnprintf(dest, len, "%s/lxc/lock/%s/.%s", rundir, p, n);
if (ret < 0 || (size_t)ret >= len) if (ret < 0)
return ret_set_errno(NULL, EIO); return NULL;
return move_ptr(dest); return move_ptr(dest);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment