Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/gen always initialize iovcnt



details:   https://anonhg.NetBSD.org/src/rev/ac39348753e1
branches:  trunk
changeset: 823293:ac39348753e1
user:      maya <maya%NetBSD.org@localhost>
date:      Tue Apr 18 12:34:07 2017 +0000

description:
always initialize iovcnt

from clang static analyzer

diffstat:

 lib/libc/gen/xsyslog.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 77974030aa15 -r ac39348753e1 lib/libc/gen/xsyslog.c
--- a/lib/libc/gen/xsyslog.c    Tue Apr 18 12:17:12 2017 +0000
+++ b/lib/libc/gen/xsyslog.c    Tue Apr 18 12:34:07 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xsyslog.c,v 1.4 2017/03/22 19:36:04 kre Exp $  */
+/*     $NetBSD: xsyslog.c,v 1.5 2017/04/18 12:34:07 maya Exp $ */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)syslog.c   8.5 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: xsyslog.c,v 1.4 2017/03/22 19:36:04 kre Exp $");
+__RCSID("$NetBSD: xsyslog.c,v 1.5 2017/04/18 12:34:07 maya Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -154,7 +154,7 @@
        struct iovec iov[7];    /* prog + [ + pid + ]: + fmt + crlf */
        int opened, iovcnt;
 
-       opened = 0;
+       iovcnt = opened = 0;
 
 #define INTERNALLOG    LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID
        /* Check for invalid bits. */
@@ -205,7 +205,6 @@
        (*fun->unlock)(data);
 
        if (data->log_stat & (LOG_PERROR|LOG_CONS)) {
-               iovcnt = 0;
                iov[iovcnt].iov_base = p;
                iov[iovcnt].iov_len = prlen - 1;
                iovcnt++;



Home | Main Index | Thread Index | Old Index