Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Jan 2012 14:59:11 -0600
From:      Dan McGregor <danismostlikely@gmail.com>
To:        freebsd-current@freebsd.org
Subject:   ctlstat not building with clang
Message-ID:  <CACS%2B7ZT5Mi=v41cpE9ZP0hjiHA1THwZFn-jZfTqHL1O4N-8beg@mail.gmail.com>

index | next in thread | raw e-mail

[-- Attachment #1 --]
Building world with clang now (as of r229997) no longer compiles because
ctlstat was imported into the tree.  The error is:

clang -O2 -pipe  -I/usr/src/usr.bin/ctlstat/../../sys -std=gnu99
-fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W
-Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes
-Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow
-Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs
-Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c
/usr/src/usr.bin/ctlstat/ctlstat.c
/usr/src/usr.bin/ctlstat/ctlstat.c:149:35: error: format string is not a
string literal (potentially insecure)
      [-Werror,-Wformat-security]
        fprintf(error ? stderr : stdout, ctlstat_usage);
                                         ^~~~~~~~~~~~~
1 error generated.
*** Error code 1

Stop in /usr/src/usr.bin/ctlstat

How do people feel about the attached patch that turns a call to fprintf to
fputs?

[-- Attachment #2 --]
Index: ctlstat.c
===================================================================
--- ctlstat.c   (revision 230026)
+++ ctlstat.c   (working copy)
@@ -146,7 +146,7 @@
 static void
 usage(int error)
 {
-       fprintf(error ? stderr : stdout, ctlstat_usage);
+       fputs(ctlstat_usage, error ? stderr : stdout);
 }
 
 static int
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACS%2B7ZT5Mi=v41cpE9ZP0hjiHA1THwZFn-jZfTqHL1O4N-8beg>