Skip to content

Commit

Permalink
confile_utils: apply strprint()
Browse files Browse the repository at this point in the history
Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
  • Loading branch information
2xsec authored and Christian Brauner committed May 31, 2018
1 parent d7aaa23 commit 2d7c634
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/lxc/confile_utils.c
Expand Up @@ -635,32 +635,47 @@ int lxc_get_conf_str(char *retv, int inlen, const char *value)

int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen, int v)
{
int len;
int fulllen = 0;

if (!retv)
inlen = 0;
else
memset(retv, 0, inlen);

return snprintf(retv, inlen, "%d", v);
strprint(retv, inlen, "%d", v);

return fulllen;
}

int lxc_get_conf_size_t(struct lxc_conf *c, char *retv, int inlen, size_t v)
{
int len;
int fulllen = 0;

if (!retv)
inlen = 0;
else
memset(retv, 0, inlen);

return snprintf(retv, inlen, "%zu", v);
strprint(retv, inlen, "%zu", v);

return fulllen;
}

int lxc_get_conf_uint64(struct lxc_conf *c, char *retv, int inlen, uint64_t v)
{
int len;
int fulllen = 0;

if (!retv)
inlen = 0;
else
memset(retv, 0, inlen);

return snprintf(retv, inlen, "%"PRIu64, v);
strprint(retv, inlen, "%"PRIu64, v);

return fulllen;
}

bool parse_limit_value(const char **value, rlim_t *res)
Expand Down

0 comments on commit 2d7c634

Please sign in to comment.