cmsg: Use do/while for error and errorf

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 <wking@tremily.us>
This commit is contained in:
W. Trevor King 2018-02-23 11:14:37 -08:00
parent 9356aa9dd8
commit f3c9a6c4ab

View file

@ -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