From: Christian Brauner Date: Thu, 10 Dec 2020 19:41:56 +0000 (+0100) Subject: confile_utils: cleanup strprint() X-Git-Tag: lxc-5.0.0~330^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1530e041bbd1b5f6cf21e255dd10c19f58cef694;p=thirdparty%2Flxc.git confile_utils: cleanup strprint() Signed-off-by: Christian Brauner --- 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,