From 1530e041bbd1b5f6cf21e255dd10c19f58cef694 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 10 Dec 2020 20:41:56 +0100 Subject: [PATCH] confile_utils: cleanup strprint() Signed-off-by: Christian Brauner --- src/lxc/confile_utils.h | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/lxc/confile_utils.h b/src/lxc/confile_utils.h index 3da1f462a..670f3894b 100644 --- a/src/lxc/confile_utils.h +++ b/src/lxc/confile_utils.h @@ -9,24 +9,22 @@ #include "conf.h" #include "confile_utils.h" -#define strprint(str, inlen, ...) \ - do { \ - if (str) \ - len = snprintf(str, inlen, ##__VA_ARGS__); \ - else \ - len = snprintf((char *){""}, 0, ##__VA_ARGS__); \ - if (len < 0) { \ - SYSERROR("failed to create string"); \ - return -1; \ - }; \ - fulllen += len; \ - if (inlen > 0) { \ - if (str) \ - str += len; \ - inlen -= len; \ - if (inlen < 0) \ - inlen = 0; \ - } \ +#define strprint(str, inlen, ...) \ + do { \ + if (str) \ + len = snprintf(str, inlen, ##__VA_ARGS__); \ + else \ + len = snprintf((char *){""}, 0, ##__VA_ARGS__); \ + if (len < 0) \ + return log_error_errno(-EIO, EIO, "failed to create string"); \ + fulllen += len; \ + if (inlen > 0) { \ + if (str) \ + str += len; \ + inlen -= len; \ + if (inlen < 0) \ + inlen = 0; \ + } \ } while (0); __hidden extern int parse_idmaps(const char *idmap, char *type, unsigned long *nsid, -- 2.47.2