rrd_daemon.c: In function ‘handle_request_list’:
rrd_daemon.c:2587:22: warning: comparison between pointer and zero character constant [-Wpointer-compare]
} while (start_ptr != '\0');
^~
rrd_daemon.c:2587:12: note: did you mean to dereference the pointer?
} while (start_ptr != '\0');
I thought this might be related to what travis picked up with valgrind
here, but I couldn't reproduce it. Also I don't think this commit fixes a
bug; all it's doing is cleaning up the compiler warning.
Starting rrdcached...
OK: empty directory ./list1_dir returns nothing
==23957== LEAK SUMMARY:
==23957== definitely lost: 0 bytes in 0 blocks
==23957== indirectly lost: 0 bytes in 0 blocks
==23957== possibly lost: 0 bytes in 0 blocks
==23957== still reachable: 14,712 bytes in 6 blocks
==23957== suppressed: 0 bytes in 0 blocks
==23957==
==23957== For counts of detected and suppressed errors, rerun with: -v
==23957== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)
FAILED: (rc=valgrind error) single file /list1.rrd
FAIL: list1
start_ptr = list;
end_ptr = list;
- do {
+ while (*start_ptr != '\0') {
end_ptr = strchr(start_ptr, '\n');
if (end_ptr == NULL) {
end_ptr = start_ptr + strlen(start_ptr);
-
- if (end_ptr == start_ptr) {
- break;
- }
- }
+ }
if ((end_ptr - start_ptr + strlen(fullpath) + 1) >= PATH_MAX) {
/* Name too long: skip entry */
loop_next:
start_ptr = end_ptr + 1;
- } while (start_ptr != '\0');
+ }
free(list);