This patch removes the GNU-isms in the die defines and replaces them with inline functions. Bastian -- She won' go Warp 7, Cap'n! The batteries are dead!
diff -urN -x CVS cvs-patch01-bool/fenced/fd.h cvs-patch02-gnuism/fenced/fd.h --- cvs-patch01-bool/fenced/fd.h 2005-02-17 18:43:21.000000000 +0100 +++ cvs-patch02-gnuism/fenced/fd.h 2005-02-17 18:43:29.000000000 +0100 @@ -15,6 +15,7 @@ #define __FD_DOT_H__ #include <pthread.h> +#include <stdarg.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> @@ -57,24 +58,30 @@ #define MAX_NAME_LEN 33 /* use this one before we fork into the background */ -#define die1(fmt, args...) \ -do \ -{ \ - fprintf(stderr, "%s: ", prog_name); \ - fprintf(stderr, fmt "\n", ##args); \ - exit(EXIT_FAILURE); \ -} \ -while (0) +static inline void die1(const char *fmt, ...) +{ + va_list ap; + fputs(prog_name, stderr); + fputs(": ", stderr); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fputs("\n", stderr); + exit(EXIT_FAILURE); +} -#define die(fmt, args...) \ -do \ -{ \ - fprintf(stderr, "%s: ", prog_name); \ - fprintf(stderr, fmt "\n", ##args); \ - syslog(LOG_ERR, fmt, ##args); \ - exit(EXIT_FAILURE); \ -} \ -while (0) +static inline void die(const char *fmt, ...) +{ + va_list ap; + fputs(prog_name, stderr); + fputs(": ", stderr); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + fputs("\n", stderr); + vsyslog(LOG_ERR, fmt, ap); + va_end(ap); + exit(EXIT_FAILURE); +} #define FENCE_ASSERT(x, todo) \ do \ diff -urN -x CVS cvs-patch01-bool/fence_node/fence_node.c cvs-patch02-gnuism/fence_node/fence_node.c --- cvs-patch01-bool/fence_node/fence_node.c 2005-02-10 06:33:28.000000000 +0100 +++ cvs-patch02-gnuism/fence_node/fence_node.c 2005-02-17 18:25:38.000000000 +0100 @@ -11,6 +11,7 @@ ******************************************************************************* ******************************************************************************/ +#include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -22,21 +23,24 @@ #define OPTION_STRING ("hOuV") -#define die(fmt, args...) \ -do \ -{ \ - fprintf(stderr, "%s: ", prog_name); \ - fprintf(stderr, fmt "\n", ##args); \ - exit(EXIT_FAILURE); \ -} \ -while (0) - static char *prog_name; static int unfence; static int force; int dispatch_fence_agent(int cd, char *victim, int in); +static inline void die(const char *fmt, ...) +{ + va_list ap; + fputs(prog_name, stderr); + fputs(": ", stderr); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fputs("\n", stderr); + exit(EXIT_FAILURE); +} + static void print_usage(void) { printf("Usage:\n"); diff -urN -x CVS cvs-patch01-bool/fence_tool/fence_tool.c cvs-patch02-gnuism/fence_tool/fence_tool.c --- cvs-patch01-bool/fence_tool/fence_tool.c 2005-02-17 18:09:30.000000000 +0100 +++ cvs-patch02-gnuism/fence_tool/fence_tool.c 2005-02-17 18:19:19.000000000 +0100 @@ -17,6 +17,7 @@ #include <stddef.h> #include <signal.h> #include <string.h> +#include <stdarg.h> #include <stdbool.h> #include <stdint.h> #include <sys/ioctl.h> @@ -42,16 +43,6 @@ #define OP_MONITOR 3 #define OP_WAIT 4 - -#define die(fmt, args...) \ -do \ -{ \ - fprintf(stderr, "%s: ", prog_name); \ - fprintf(stderr, fmt "\n", ##args); \ - exit(EXIT_FAILURE); \ -} \ -while (0) - char *prog_name; bool debug = false; int operation; @@ -62,6 +53,17 @@ int dispatch_fence_agent(int cd, char *victim, int in); +static inline void die(const char *fmt, ...) +{ + va_list ap; + fputs(prog_name, stderr); + fputs(": ", stderr); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fputs("\n", stderr); + exit(EXIT_FAILURE); +} static int check_mounted(void) {
Attachment:
signature.asc
Description: Digital signature