From f3c9a6c4abcd129e237638f20b4f38dbc09de8bc Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 23 Feb 2018 11:14:37 -0800 Subject: [PATCH] cmsg: Use do/while for error and errorf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid: $ make clean && make CFLAGS='-Wpedantic' cmsg.o 2>&1 | head -n5 rm -f conmon.o cmsg.o ../bin/conmon cc -Wpedantic -std=c99 -Os -Wall -Wextra -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -c -o cmsg.o cmsg.c cmsg.c: In function ‘recvfd’: cmsg.c:30:2: warning: ISO C forbids braced-groups within expressions [-Wpedantic] ({ \ ^ Signed-off-by: W. Trevor King --- conmon/cmsg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conmon/cmsg.c b/conmon/cmsg.c index 6587a15c..53010061 100644 --- a/conmon/cmsg.c +++ b/conmon/cmsg.c @@ -27,18 +27,18 @@ #include "cmsg.h" #define error(s) \ - ({ \ + do { \ fprintf(stderr, "nsenter: %s %s\n", s, strerror(errno)); \ errno = ECOMM; \ goto err; /* return value */ \ - }) + } while (0) #define errorf(fmt, ...) \ - ({ \ + do { \ fprintf(stderr, "nsenter: " fmt ": %s\n", ##__VA_ARGS__, strerror(errno)); \ errno = ECOMM; \ goto err; /* return value */ \ - }) + } while (0) /* * Sends a file descriptor along the sockfd provided. Returns the return