Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/isdn/isdnd Avoid non-literal format strings



details:   https://anonhg.NetBSD.org/src/rev/f74b957c0438
branches:  trunk
changeset: 768410:f74b957c0438
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Aug 16 10:39:31 2011 +0000

description:
Avoid non-literal format strings

diffstat:

 usr.sbin/isdn/isdnd/rc_parse.y |  21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diffs (51 lines):

diff -r f9014a877ab3 -r f74b957c0438 usr.sbin/isdn/isdnd/rc_parse.y
--- a/usr.sbin/isdn/isdnd/rc_parse.y    Tue Aug 16 10:35:03 2011 +0000
+++ b/usr.sbin/isdn/isdnd/rc_parse.y    Tue Aug 16 10:39:31 2011 +0000
@@ -30,7 +30,7 @@
  *     i4b daemon - runtime configuration parser
  *     -----------------------------------------
  *
- *     $Id: rc_parse.y,v 1.6 2009/04/16 05:56:32 lukem Exp $ 
+ *     $Id: rc_parse.y,v 1.7 2011/08/16 10:39:31 christos Exp $ 
  *
  * $FreeBSD$
  *
@@ -249,26 +249,31 @@
 sysmonitorstart:
                MONITOR '=' STRING '\n'
                        {
-                           const char *err = NULL;
+                           const char *emsg;
                            switch (monitor_start_rights($3)) {
                                case I4BMAR_OK:
+                                       emsg = NULL;
                                        break;
                                case I4BMAR_LENGTH:
-                                       err = "local socket name too long: %s";
+                                       emsg = "local socket name too long";
                                        break;
                                case I4BMAR_DUP:
-                                       err = "duplicate entry: %s";
+                                       emsg = "duplicate entry";
                                        break;
                                case I4BMAR_CIDR:
-                                       err = "invalid CIDR specification: %s";
+                                       emsg = "invalid CIDR specification";
                                        break;
                                case I4BMAR_NOIP:
-                                       err = "could not resolve host or net specification: %s";
+                                       emsg = "could not resolve host or net "
+                                           "specification";
                                        break;
+                               default:
+                                       emsg = "unknown";
+                                       break;
                            }
-                           if (err) {
+                           if (emsg) {
                                char msg[1024];
-                               snprintf(msg, sizeof msg, err, $3);
+                               snprintf(msg, sizeof msg, "%s: %s", emsg, $3);
                                yyerror(msg);
                            }
                        }



Home | Main Index | Thread Index | Old Index