Fix compilation warnings on all Debian architectures. (#3007)
stbuf.st_size is of type off_t, which the standard defines as “extended signed integral type”¹, and for which there is no correct printf format string. Hence, we need to cast it into a hopefully-large-enough type (ugh) and use the corresponding format string. In our case, int64_t should do it, as config files really shouldn’t be anywhere close to those numbers. ① http://pubs.opengroup.org/onlinepubs/007908799/xsh/systypes.h.html
This commit is contained in:
committed by
GitHub
parent
962750eb64
commit
21cdcdb07c
@ -500,7 +500,7 @@ ssize_t slurp(const char *path, char **buf) {
|
||||
size_t n = fread(*buf, 1, stbuf.st_size, f);
|
||||
fclose(f);
|
||||
if ((ssize_t)n != stbuf.st_size) {
|
||||
ELOG("File \"%s\" could not be read entirely: got %zd, want %zd\n", path, n, stbuf.st_size);
|
||||
ELOG("File \"%s\" could not be read entirely: got %zd, want %" PRIi64 "\n", path, n, (int64_t)stbuf.st_size);
|
||||
free(*buf);
|
||||
*buf = NULL;
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user