]> arthur.barton.de Git - netdata.git/commitdiff
fix for format string signess
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Thu, 16 Jun 2016 22:40:44 +0000 (01:40 +0300)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Thu, 16 Jun 2016 22:40:44 +0000 (01:40 +0300)
src/common.c
src/daemon.c
src/proc_vmstat.c
src/procfile.c

index 266e5ac12ed7950f6800fb6efaefa8e56a8627a4..699f58c64d025938456eb35553795dcb6711db32 100644 (file)
@@ -685,7 +685,7 @@ void *mymmap(const char *filename, size_t size, int flags, int ksm)
                if(lseek(fd, size, SEEK_SET) == (off_t)size) {
                        if(write(fd, "", 1) == 1) {
                                if(ftruncate(fd, size))
-                                       error("Cannot truncate file '%s' to size %ld. Will use the larger file.", filename, size);
+                                       error("Cannot truncate file '%s' to size %zu. Will use the larger file.", filename, size);
 
 #ifdef MADV_MERGEABLE
                                if(flags & MAP_SHARED || !enable_ksm || !ksm) {
@@ -734,9 +734,9 @@ void *mymmap(const char *filename, size_t size, int flags, int ksm)
                                }
 #endif
                        }
-                       else error("Cannot write to file '%s' at position %ld.", filename, size);
+                       else error("Cannot write to file '%s' at position %zu.", filename, size);
                }
-               else error("Cannot seek file '%s' to size %ld.", filename, size);
+               else error("Cannot seek file '%s' to size %zu.", filename, size);
 
                close(fd);
        }
index 05a77c7c67a2975a660f4c49610badbbff650104..33d3d0c1d819dfc2e10523f3825dbdd0b06c97bb 100644 (file)
@@ -93,29 +93,29 @@ int become_user(const char *username, int access_fd, int output_fd, int error_fd
        }
 
        if(setresgid(gid, gid, gid) != 0) {
-               error("Cannot switch to user's %s group (gid: %d).", username, gid);
+               error("Cannot switch to user's %s group (gid: %u).", username, gid);
                return -1;
        }
 
        if(setresuid(uid, uid, uid) != 0) {
-               error("Cannot switch to user %s (uid: %d).", username, uid);
+               error("Cannot switch to user %s (uid: %u).", username, uid);
                return -1;
        }
 
        if(setgid(gid) != 0) {
-               error("Cannot switch to user's %s group (gid: %d).", username, gid);
+               error("Cannot switch to user's %s group (gid: %u).", username, gid);
                return -1;
        }
        if(setegid(gid) != 0) {
-               error("Cannot effectively switch to user's %s group (gid: %d).", username, gid);
+               error("Cannot effectively switch to user's %s group (gid: %u).", username, gid);
                return -1;
        }
        if(setuid(uid) != 0) {
-               error("Cannot switch to user %s (uid: %d).", username, uid);
+               error("Cannot switch to user %s (uid: %u).", username, uid);
                return -1;
        }
        if(seteuid(uid) != 0) {
-               error("Cannot effectively switch to user %s (uid: %d).", username, uid);
+               error("Cannot effectively switch to user %s (uid: %u).", username, uid);
                return -1;
        }
 
index a63caf2765de96a18983e0fdd46999cfddc8f128..c69b389b6c875af18105087321046f2bfba41d47 100644 (file)
@@ -321,7 +321,7 @@ int do_proc_vmstat(int update_every, unsigned long long dt) {
        for(l = 0; l < lines ;l++) {
                words = procfile_linewords(ff, l);
                if(words < 2) {
-                       if(words) error("Cannot read /proc/vmstat line %d. Expected 2 params, read %u.", l, words);
+                       if(words) error("Cannot read /proc/vmstat line %u. Expected 2 params, read %u.", l, words);
                        continue;
                }
 
index 59f75c1ecea132abfde7a42fab1a3f41b75c2e22..25f9d2e749639077cd7f879c6f819f66600ac6a9 100644 (file)
@@ -325,7 +325,7 @@ procfile *procfile_readall(procfile *ff) {
                        ff->size += PROCFILE_INCREMENT_BUFFER;
                }
 
-               debug(D_PROCFILE, "Reading file '%s', from position %ld with length %ld", ff->filename, s, ff->size - s);
+               debug(D_PROCFILE, "Reading file '%s', from position %ld with length %lu", ff->filename, s, ff->size - s);
                r = read(ff->fd, &ff->data[s], ff->size - s);
                if(unlikely(r == -1)) {
                        if(unlikely(!(ff->flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) error(PF_PREFIX ": Cannot read from file '%s'", ff->filename);
@@ -496,16 +496,16 @@ void procfile_print(procfile *ff) {
        uint32_t words, w;
        char *s;
 
-       debug(D_PROCFILE, "File '%s' with %d lines and %d words", ff->filename, ff->lines->len, ff->words->len);
+       debug(D_PROCFILE, "File '%s' with %u lines and %u words", ff->filename, ff->lines->len, ff->words->len);
 
        for(l = 0; likely(l < lines) ;l++) {
                words = procfile_linewords(ff, l);
 
-               debug(D_PROCFILE, "     line %d starts at word %d and has %d words", l, ff->lines->lines[l].first, ff->lines->lines[l].words);
+               debug(D_PROCFILE, "     line %u starts at word %u and has %u words", l, ff->lines->lines[l].first, ff->lines->lines[l].words);
 
                for(w = 0; likely(w < words) ;w++) {
                        s = procfile_lineword(ff, l, w);
-                       debug(D_PROCFILE, "             [%d.%d] '%s'", l, w, s);
+                       debug(D_PROCFILE, "             [%u.%u] '%s'", l, w, s);
                }
        }
 }