]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile_utils: cleanup strprint()
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 10 Dec 2020 19:41:56 +0000 (20:41 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 10 Dec 2020 19:41:56 +0000 (20:41 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile_utils.h

index 3da1f462a3877d0bf1edb45bb4b9b1a10b0b7dae..670f3894b8774d0d5b22e356a0bb0cee57fce8d0 100644 (file)
@@ -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,