libquota: quiet log_err() bad format warnings

The macro for log_err() was written so that it needed to always
have an argument, but GCC was unhappy to have an argument when
none was specified in the format string.  Use the CPP "##" to
eat the preceeding comma if no argument is specified.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
diff --git a/lib/quota/common.h b/lib/quota/common.h
index b5e8331..7f3f4b9 100644
--- a/lib/quota/common.h
+++ b/lib/quota/common.h
@@ -13,14 +13,14 @@
 # endif
 #endif
 
-#define log_err(format, ...)	fprintf(stderr, \
-				"[ERROR] %s:%d:%s:: " format "\n", \
-				__FILE__, __LINE__, __func__, __VA_ARGS__)
+#define log_err(format, arg ...)					\
+	fprintf(stderr, "[ERROR] %s:%d:%s:: " format "\n",		\
+		__FILE__, __LINE__, __func__, ## arg)
 
 #ifdef DEBUG_QUOTA
-# define log_debug(format, ...)	fprintf(stderr, \
-				"[DEBUG] %s:%d:%s:: " format "\n", \
-				__FILE__, __LINE__, __func__, __VA_ARGS__)
+# define log_debug(format, arg ...)					\
+	fprintf(stderr, "[DEBUG] %s:%d:%s:: " format "\n",		\
+		__FILE__, __LINE__, __func__, ## arg)
 #else
 # define log_debug(format, ...)
 #endif
diff --git a/lib/quota/mkquota.c b/lib/quota/mkquota.c
index fd3fbb5..8d087da 100644
--- a/lib/quota/mkquota.c
+++ b/lib/quota/mkquota.c
@@ -132,7 +132,7 @@
 	fs = qctx->fs;
 	retval = ext2fs_get_mem(sizeof(struct quota_handle), &h);
 	if (retval) {
-		log_err("Unable to allocate quota handle", "");
+		log_err("Unable to allocate quota handle");
 		goto out;
 	}
 
@@ -148,7 +148,7 @@
 
 		retval = quota_file_create(h, fs, i, fmt);
 		if (retval < 0) {
-			log_err("Cannot initialize io on quotafile", "");
+			log_err("Cannot initialize io on quotafile");
 			continue;
 		}
 
@@ -218,7 +218,7 @@
 
 	err = ext2fs_get_mem(sizeof(struct quota_ctx), &ctx);
 	if (err) {
-		log_err("Failed to allocate quota context", "");
+		log_err("Failed to allocate quota context");
 		return err;
 	}
 
@@ -228,7 +228,7 @@
 			continue;
 		err = ext2fs_get_mem(sizeof(dict_t), &dict);
 		if (err) {
-			log_err("Failed to allocate dictionary", "");
+			log_err("Failed to allocate dictionary");
 			return err;
 		}
 		ctx->quota_dict[i] = dict;
@@ -273,7 +273,7 @@
 		dq = dnode_get(n);
 	else {
 		if (ext2fs_get_mem(sizeof(struct dquot), &dq)) {
-			log_err("Unable to allocate dquot", "");
+			log_err("Unable to allocate dquot");
 			return NULL;
 		}
 		memset(dq, 0, sizeof(struct dquot));
@@ -425,9 +425,10 @@
 		scan_data->usage_is_inconsistent = 1;
 		fprintf(stderr, "[QUOTA WARNING] Usage inconsistent for ID %d:"
 			"actual (%llu, %llu) != expected (%llu, %llu)\n",
-			dq->dq_id, dq->dq_dqb.dqb_curspace,
-			dq->dq_dqb.dqb_curinodes, dquot->dq_dqb.dqb_curspace,
-			dquot->dq_dqb.dqb_curinodes);
+			dq->dq_id, (long long)dq->dq_dqb.dqb_curspace,
+			(long long)dq->dq_dqb.dqb_curinodes,
+			(long long)dquot->dq_dqb.dqb_curspace,
+			(long long)dquot->dq_dqb.dqb_curinodes);
 	}
 
 	if (scan_data->update_limits) {
@@ -463,6 +464,7 @@
 /*
  * Write all memory dquots into quota file
  */
+#if 0 /* currently unused, but may be useful in the future? */
 static errcode_t quota_write_all_dquots(struct quota_handle *qh,
                                         quota_ctx_t qctx)
 {
@@ -477,6 +479,7 @@
 	ext2fs_write_bitmaps(qctx->fs);
 	return 0;
 }
+#endif
 
 /*
  * Updates the in-memory quota limits from the given quota inode.
@@ -491,13 +494,13 @@
 
 	err = ext2fs_get_mem(sizeof(struct quota_handle), &qh);
 	if (err) {
-		log_err("Unable to allocate quota handle", "");
+		log_err("Unable to allocate quota handle");
 		return err;
 	}
 
 	err = quota_file_open(qh, qctx->fs, qf_ino, type, -1, 0);
 	if (err) {
-		log_err("Open quota file failed", "");
+		log_err("Open quota file failed");
 		goto out;
 	}
 
@@ -536,7 +539,7 @@
 				     fs->super->s_grp_quota_inum;
 	err = quota_file_open(&qh, fs, qf_ino, qtype, -1, 0);
 	if (err) {
-		log_err("Open quota file failed", "");
+		log_err("Open quota file failed");
 		goto out;
 	}
 
@@ -546,7 +549,7 @@
 	scan_data.usage_is_inconsistent = 0;
 	err = qh.qh_ops->scan_dquots(&qh, scan_dquots_callback, &scan_data);
 	if (err) {
-		log_err("Error scanning dquots", "");
+		log_err("Error scanning dquots");
 		goto out;
 	}
 	*usage_inconsistent = scan_data.usage_is_inconsistent;
diff --git a/lib/quota/quotaio.c b/lib/quota/quotaio.c
index ac34a80..8ddb92a 100644
--- a/lib/quota/quotaio.c
+++ b/lib/quota/quotaio.c
@@ -243,13 +243,13 @@
 
 	if (h->qh_ops->check_file &&
 	    (h->qh_ops->check_file(h, type, fmt) == 0)) {
-		log_err("qh_ops->check_file failed", "");
+		log_err("qh_ops->check_file failed");
 		ext2fs_file_close(e2_file);
 		return -1;
 	}
 
 	if (h->qh_ops->init_io && (h->qh_ops->init_io(h) < 0)) {
-		log_err("qh_ops->init_io failed", "");
+		log_err("qh_ops->init_io failed");
 		ext2fs_file_close(e2_file);
 		return -1;
 	}
@@ -264,7 +264,7 @@
 
 	err = ext2fs_read_inode(fs, ino, &inode);
 	if (err) {
-		log_err("ex2fs_read_inode failed", "");
+		log_err("ex2fs_read_inode failed");
 		return err;
 	}
 
@@ -316,7 +316,7 @@
 
 	err = quota_inode_init_new(fs, qf_inum);
 	if (err) {
-		log_err("init_new_quota_inode failed", "");
+		log_err("init_new_quota_inode failed");
 		goto out_err;
 	}
 	h->qh_qf.ino = qf_inum;
@@ -339,7 +339,7 @@
 	h->qh_ops = &quotafile_ops_2;
 
 	if (h->qh_ops->new_io && (h->qh_ops->new_io(h) < 0)) {
-		log_err("qh_ops->new_io failed", "");
+		log_err("qh_ops->new_io failed");
 		goto out_err1;
 	}
 
@@ -386,7 +386,7 @@
 	struct dquot *dquot;
 
 	if (ext2fs_get_memzero(sizeof(struct dquot), &dquot)) {
-		log_err("Failed to allocate dquot", "");
+		log_err("Failed to allocate dquot");
 		return NULL;
 	}
 
diff --git a/lib/quota/quotaio_tree.c b/lib/quota/quotaio_tree.c
index 9080e77..e7aea3b 100644
--- a/lib/quota/quotaio_tree.c
+++ b/lib/quota/quotaio_tree.c
@@ -24,7 +24,7 @@
 {
 	dqbuf_t buf;
 	if (ext2fs_get_memzero(QT_BLKSIZE, &buf)) {
-		log_err("Failed to allocate dqbuf", "");
+		log_err("Failed to allocate dqbuf");
 		return NULL;
 	}
 
@@ -101,7 +101,7 @@
 		if (write_blk(h, info->dqi_blocks, buf) < 0) {
 			freedqbuf(buf);
 			log_err("Cannot allocate new quota block "
-				"(out of disk space).", "");
+				"(out of disk space).");
 			return -ENOSPC;
 		}
 		blk = info->dqi_blocks++;
@@ -230,8 +230,7 @@
 		ddquot += info->dqi_entry_size;
 
 	if (i == qtree_dqstr_in_blk(info))
-		log_err("find_free_dqentry(): Data block full but it "
-			"shouldn't.", "");
+		log_err("find_free_dqentry(): Data block full unexpectedly.");
 
 	write_blk(h, blk, buf);
 	dquot->dq_dqb.u.v2_mdqb.dqb_off =
diff --git a/lib/quota/quotaio_v2.c b/lib/quota/quotaio_v2.c
index f8d553b..e7bf29c 100644
--- a/lib/quota/quotaio_v2.c
+++ b/lib/quota/quotaio_v2.c
@@ -160,8 +160,7 @@
 
 	if (ext2fs_le32_to_cpu(dqh.dqh_magic) != file_magics[type]) {
 		if (ext2fs_be32_to_cpu(dqh.dqh_magic) == file_magics[type])
-			log_err("Your quota file is stored in wrong "
-				"endianity.", "");
+			log_err("Your quota file is stored in wrong endianity");
 		return 0;
 	}
 	if (V2_VERSION != ext2fs_le32_to_cpu(dqh.dqh_version))
@@ -279,6 +278,6 @@
  */
 static int v2_report(struct quota_handle *h, int verbose)
 {
-	log_err("Not Implemented.", "");
+	log_err("Not Implemented.");
 	return -1;
 }