From 688df7cfa5f1c964f7a5d7a871dbd951df1d7467 Mon Sep 17 00:00:00 2001 From: guenther Date: Sun, 20 Jul 2014 00:46:26 +0000 Subject: [PATCH] Mark fatal() as printf-like. Don't put a format string that's only used once in a variable. --- sbin/newfs/newfs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index c38de189fb0..27e37a00dfb 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newfs.c,v 1.95 2013/11/22 04:12:48 deraadt Exp $ */ +/* $OpenBSD: newfs.c,v 1.96 2014/07/20 00:46:26 guenther Exp $ */ /* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */ /* @@ -79,7 +79,9 @@ struct mntopt mopts[] = { { NULL }, }; -void fatal(const char *fmt, ...); +void fatal(const char *fmt, ...) + __attribute__((__format__ (printf, 1, 2))) + __attribute__((__nonnull__ (1))); __dead void usage(void); void mkfs(struct partition *, char *, int, int, mode_t, uid_t, gid_t); void rewritelabel(char *, int, struct disklabel *); @@ -561,8 +563,6 @@ havelabel: exit(0); } -char lmsg[] = "%s: can't read disk label; disk type must be specified"; - struct disklabel * getdisklabel(char *s, int fd) { @@ -579,7 +579,8 @@ getdisklabel(char *s, int fd) return (lp); } warn("ioctl (GDINFO)"); - fatal(lmsg, s); + fatal("%s: can't read disk label; disk type must be specified", + s); } return (&lab); } -- 2.20.1