]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
case to unsigned; reorder expression
authorMark Andrews <marka@isc.org>
Thu, 15 Feb 2018 02:20:59 +0000 (13:20 +1100)
committerMark Andrews <marka@isc.org>
Fri, 16 Feb 2018 07:25:33 +0000 (18:25 +1100)
lib/isc/log.c
util/copyrights

index 391f5b5c271bcbb82b16566c041102abeb96f2a0..703721aee88376f7614cb71ea3fffcd4f270349f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004-2007, 2009, 2011-2014, 2016, 2017  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2007, 2009, 2011-2014, 2016-2018  Internet Systems Consortium, Inc. ("ISC")
  * Copyright (C) 1999-2003  Internet Software Consortium.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
@@ -1226,7 +1226,7 @@ static isc_result_t
 roll_log(isc_logchannel_t *channel) {
        int i, n, greatest;
        char current[PATH_MAX + 1];
-       char new[PATH_MAX + 1];
+       char newpath[PATH_MAX + 1];
        const char *path;
        isc_result_t result;
 
@@ -1246,10 +1246,9 @@ roll_log(isc_logchannel_t *channel) {
                 */
                for (greatest = 0; greatest < INT_MAX; greatest++) {
                        n = snprintf(current, sizeof(current),
-                                    "%s.%u", path, greatest) ;
-                       if (n >= (int)sizeof(current) || n < 0)
-                               break;
-                       if (!isc_file_exists(current))
+                                    "%s.%u", path, (unsigned)greatest) ;
+                       if (n >= (int)sizeof(current) || n < 0 ||
+                           !isc_file_exists(current))
                                break;
                }
        } else {
@@ -1271,16 +1270,20 @@ roll_log(isc_logchannel_t *channel) {
 
        for (i = greatest; i > 0; i--) {
                result = ISC_R_SUCCESS;
-               n = snprintf(current, sizeof(current), "%s.%u", path, i - 1);
-               if (n >= (int)sizeof(current) || n < 0)
+               n = snprintf(current, sizeof(current), "%s.%u", path,
+                            (unsigned)(i - 1));
+               if (n >= (int)sizeof(current) || n < 0) {
                        result = ISC_R_NOSPACE;
+               }
                if (result == ISC_R_SUCCESS) {
-                       n = snprintf(new, sizeof(new), "%s.%u", path, i);
-                       if (n >= (int)sizeof(new) || n < 0)
+                       n = snprintf(newpath, sizeof(newpath), "%s.%u",
+                                    path, (unsigned)i);
+                       if (n >= (int)sizeof(newpath) || n < 0) {
                                result = ISC_R_NOSPACE;
+                       }
                }
                if (result == ISC_R_SUCCESS)
-                       result = isc_file_rename(current, new);
+                       result = isc_file_rename(current, newpath);
                if (result != ISC_R_SUCCESS &&
                    result != ISC_R_FILENOTFOUND)
                        syslog(LOG_ERR,
@@ -1290,11 +1293,11 @@ roll_log(isc_logchannel_t *channel) {
        }
 
        if (FILE_VERSIONS(channel) != 0) {
-               n = snprintf(new, sizeof(new), "%s.0", path);
-               if (n >= (int)sizeof(new) || n < 0)
+               n = snprintf(newpath, sizeof(newpath), "%s.0", path);
+               if (n >= (int)sizeof(newpath) || n < 0)
                        result = ISC_R_NOSPACE;
                else
-                       result = isc_file_rename(path, new);
+                       result = isc_file_rename(path, newpath);
                if (result != ISC_R_SUCCESS &&
                    result != ISC_R_FILENOTFOUND)
                        syslog(LOG_ERR,
index bd28718ec0117720a0a21dd8ff89d51a84f1daf2..5e013a11ae0db664c36b5f5d4b81278f5eff5097 100644 (file)
 ./lib/isc/lex.c                                        C       1998,1999,2000,2001,2002,2003,2004,2005,2007,2013,2014,2015,2017
 ./lib/isc/lfsr.c                               C       1999,2000,2001,2002,2004,2005,2007
 ./lib/isc/lib.c                                        C       1999,2000,2001,2004,2005,2007,2009,2014,2015
-./lib/isc/log.c                                        C       1999,2000,2001,2002,2003,2004,2005,2006,2007,2009,2011,2012,2013,2014,2016,2017
+./lib/isc/log.c                                        C       1999,2000,2001,2002,2003,2004,2005,2006,2007,2009,2011,2012,2013,2014,2016,2017,2018
 ./lib/isc/md5.c                                        C       2000,2001,2004,2005,2007,2009,2014,2015,2016,2017
 ./lib/isc/mem.c                                        C       1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2012,2013,2014,2015,2016,2017,2018
 ./lib/isc/mem_api.c                            C       2009,2010