Print ssize_t as %zd
On some architectures (x32) ssize_t is int, not long int.
../src/basic/confidential-virt.c: In function ‘msr’:
../src/basic/confidential-virt.c:133:27: error: format ‘%ld’ expects argument of type ‘long int’, but argument 7 has type ‘ssize_t’ {aka ‘int’} [-Werror=format=]
133 | log_debug("Short read %ld bytes from MSR device %s (index %" PRIu64 "), ignoring",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134 | rv,
| ~~
| |
| ssize_t {aka int}
../src/basic/log.h:214:86: note: in definition of macro ‘log_full_errno_zerook’
214 | ? log_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, __VA_ARGS__) \
| ^~~~~~~~~~~
../src/basic/log.h:242:28: note: in expansion of macro ‘log_full’
242 | #define log_debug(...) log_full(LOG_DEBUG, __VA_ARGS__)
| ^~~~~~~~
../src/basic/confidential-virt.c:133:17: note: in expansion of macro ‘log_debug’
133 | log_debug("Short read %ld bytes from MSR device %s (index %" PRIu64 "), ignoring",
| ^~~~~~~~~
../src/basic/confidential-virt.c:133:41: note: format string is defined here
133 | log_debug("Short read %ld bytes from MSR device %s (index %" PRIu64 "), ignoring",
| ~~^
| |
| long int
| %d
This commit is contained in:
@@ -130,7 +130,7 @@ static uint64_t msr(uint64_t index) {
|
||||
index);
|
||||
return 0;
|
||||
} else if (rv != sizeof(ret)) {
|
||||
log_debug("Short read %ld bytes from MSR device %s (index %" PRIu64 "), ignoring",
|
||||
log_debug("Short read %zd bytes from MSR device %s (index %" PRIu64 "), ignoring",
|
||||
rv,
|
||||
MSR_DEVICE,
|
||||
index);
|
||||
|
||||
Reference in New Issue
Block a user