From 5d275c29f4464fae4a3b2202c10a86f9e4e875a5 Mon Sep 17 00:00:00 2001 From: adilger Date: Thu, 10 Jul 2008 21:03:37 +0000 Subject: [PATCH] Branch b1_8_gate Fix compile warnings. Make v{err}print() be variadic macros to allow proper passing of output stream in case of error. b=15625 --- lustre/utils/mount_utils.c | 11 +++++------ lustre/utils/mount_utils.h | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lustre/utils/mount_utils.c b/lustre/utils/mount_utils.c index 17d00d7..f2f2885 100644 --- a/lustre/utils/mount_utils.c +++ b/lustre/utils/mount_utils.c @@ -10,8 +10,8 @@ extern char *progname; extern int verbose; -#define vprint if (verbose > 0) printf -#define verrprint if (verbose >= 0) printf +#define vprint(fmt, arg...) if (verbose > 0) printf(fmt, ##arg) +#define verrprint(fmt, arg...) if (verbose >= 0) fprintf(stderr, fmt, ##arg) void fatal(void) { @@ -73,9 +73,8 @@ int get_mountdata(char *dev, struct lustre_disk_data *mo_ldd) /* Make a temporary directory to hold Lustre data files. */ if (!mkdtemp(tmpdir)) { - verrprint(stderr, "%s: Can't create temporary " - "directory %s: %s\n", - progname, tmpdir, strerror(errno)); + verrprint("%s: Can't create temporary directory %s: %s\n", + progname, tmpdir, strerror(errno)); return errno; } @@ -98,7 +97,7 @@ int get_mountdata(char *dev, struct lustre_disk_data *mo_ldd) verrprint("%s: Unable to read %d.%d config %s.\n", progname, LUSTRE_MAJOR, LUSTRE_MINOR, filepnm); goto out_close; - } + } out_close: fclose(filep); diff --git a/lustre/utils/mount_utils.h b/lustre/utils/mount_utils.h index 600b6b4..3311b0f 100644 --- a/lustre/utils/mount_utils.h +++ b/lustre/utils/mount_utils.h @@ -6,6 +6,8 @@ #ifndef _MOUNT_UTILS_H_ #define _MOUNT_UTILS_H_ +#include + void fatal(void); int run_command(char *, int); int get_mountdata(char *, struct lustre_disk_data *); -- 1.8.3.1