@cryptotaxi247 / netdata-1 / commits / 0635d9515

fix for format string signess

Costa Tsaousis (ktsaou) committed Jun 17, 2016 at 01:40 UTC 0635d9515edf67c110290705693c85ad968372fd
4 files changed +14 -14
src/common.c
+3 -3
@@ -685,7 +685,7 @@ void *mymmap(const char *filename, size_t size, int flags, int ksm)
685 if(lseek(fd, size, SEEK_SET) == (off_t)size) {
686 if(write(fd, "", 1) == 1) {
687 if(ftruncate(fd, size))
688 - error("Cannot truncate file '%s' to size %ld. Will use the larger file.", filename, size);
688 + error("Cannot truncate file '%s' to size %zu. Will use the larger file.", filename, size);
689
690 #ifdef MADV_MERGEABLE
691 if(flags & MAP_SHARED || !enable_ksm || !ksm) {
@@ -734,9 +734,9 @@ void *mymmap(const char *filename, size_t size, int flags, int ksm)
734 }
735 #endif
736 }
737 - else error("Cannot write to file '%s' at position %ld.", filename, size);
737 + else error("Cannot write to file '%s' at position %zu.", filename, size);
738 }
739 - else error("Cannot seek file '%s' to size %ld.", filename, size);
739 + else error("Cannot seek file '%s' to size %zu.", filename, size);
740
741 close(fd);
742 }
src/daemon.c
+6 -6
@@ -93,29 +93,29 @@ int become_user(const char *username, int access_fd, int output_fd, int error_fd
93 }
94
95 if(setresgid(gid, gid, gid) != 0) {
96 - error("Cannot switch to user's %s group (gid: %d).", username, gid);
96 + error("Cannot switch to user's %s group (gid: %u).", username, gid);
97 return -1;
98 }
99
100 if(setresuid(uid, uid, uid) != 0) {
101 - error("Cannot switch to user %s (uid: %d).", username, uid);
101 + error("Cannot switch to user %s (uid: %u).", username, uid);
102 return -1;
103 }
104
105 if(setgid(gid) != 0) {
106 - error("Cannot switch to user's %s group (gid: %d).", username, gid);
106 + error("Cannot switch to user's %s group (gid: %u).", username, gid);
107 return -1;
108 }
109 if(setegid(gid) != 0) {
110 - error("Cannot effectively switch to user's %s group (gid: %d).", username, gid);
110 + error("Cannot effectively switch to user's %s group (gid: %u).", username, gid);
111 return -1;
112 }
113 if(setuid(uid) != 0) {
114 - error("Cannot switch to user %s (uid: %d).", username, uid);
114 + error("Cannot switch to user %s (uid: %u).", username, uid);
115 return -1;
116 }
117 if(seteuid(uid) != 0) {
118 - error("Cannot effectively switch to user %s (uid: %d).", username, uid);
118 + error("Cannot effectively switch to user %s (uid: %u).", username, uid);
119 return -1;
120 }
121
src/proc_vmstat.c
+1 -1
@@ -321,7 +321,7 @@ int do_proc_vmstat(int update_every, unsigned long long dt) {
321 for(l = 0; l < lines ;l++) {
322 words = procfile_linewords(ff, l);
323 if(words < 2) {
324 - if(words) error("Cannot read /proc/vmstat line %d. Expected 2 params, read %u.", l, words);
324 + if(words) error("Cannot read /proc/vmstat line %u. Expected 2 params, read %u.", l, words);
325 continue;
326 }
327
src/procfile.c
+4 -4
@@ -325,7 +325,7 @@ procfile *procfile_readall(procfile *ff) {
325 ff->size += PROCFILE_INCREMENT_BUFFER;
326 }
327
328 - debug(D_PROCFILE, "Reading file '%s', from position %ld with length %ld", ff->filename, s, ff->size - s);
328 + debug(D_PROCFILE, "Reading file '%s', from position %ld with length %lu", ff->filename, s, ff->size - s);
329 r = read(ff->fd, &ff->data[s], ff->size - s);
330 if(unlikely(r == -1)) {
331 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) {
496 uint32_t words, w;
497 char *s;
498
499 - debug(D_PROCFILE, "File '%s' with %d lines and %d words", ff->filename, ff->lines->len, ff->words->len);
499 + debug(D_PROCFILE, "File '%s' with %u lines and %u words", ff->filename, ff->lines->len, ff->words->len);
500
501 for(l = 0; likely(l < lines) ;l++) {
502 words = procfile_linewords(ff, l);
503
504 - debug(D_PROCFILE, " line %d starts at word %d and has %d words", l, ff->lines->lines[l].first, ff->lines->lines[l].words);
504 + debug(D_PROCFILE, " line %u starts at word %u and has %u words", l, ff->lines->lines[l].first, ff->lines->lines[l].words);
505
506 for(w = 0; likely(w < words) ;w++) {
507 s = procfile_lineword(ff, l, w);
508 - debug(D_PROCFILE, " [%d.%d] '%s'", l, w, s);
508 + debug(D_PROCFILE, " [%u.%u] '%s'", l, w, s);
509 }
510 }
511 }