devmapper: Fix build error on 32bit host
PATCH 1/1 devmapper: Fix build error on 32bit host
The gcc build has failed for 32bit host (for eg, i386-emu and arm-emu) due to mismatch between format specifier and data type.
../grub-core/osdep/devmapper/getroot.c: In function 'grub_util_pull_devmapper':
../grub-core/osdep/devmapper/getroot.c:265:75: error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Werror=format=]
../grub-core/osdep/devmapper/getroot.c:276:80: error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Werror=format=]
This patch fixes the problem by casting the type of calculated offset to grub_size_t and use platform PRIuGRUB_SIZE as format specifier.
--- grub-core/osdep/devmapper/getroot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
grub-core/osdep/devmapper/getroot.c +2 -2
@@ -262,7 +262,7 @@ grub_util_pull_devmapper (const char *os_dev) params); cipher =grub_strndup (c, seek_head - c);if (cipher ==NULL ) -grub_util_error (_ ("could not strndup cipher of length `%lu'" ), seek_head - c); +grub_util_error (_ ("could not strndup cipher of length `%" PRIuGRUB_SIZE"'" ), (grub_size_t)(seek_head - c)); remaining -= seek_head - c +1 ; c = seek_head +1 ;
@@ -273,7 +273,7 @@ grub_util_pull_devmapper (const char *os_dev) params); cipher_mode =grub_strndup (c, seek_head - c);if (cipher_mode ==NULL ) -grub_util_error (_ ("could not strndup cipher_mode of length `%lu'" ), seek_head - c); +grub_util_error (_ ("could not strndup cipher_mode of length `%" PRIuGRUB_SIZE"'" ), (grub_size_t)(seek_head - c)); remaining -= seek_head - c +1 ; c = seek_head +1 ;
Signature · 1 line
2.39.2
Quoted 10 lines · Michael Chang via Grub-devel
The gcc build has failed for 32bit host (for eg, i386-emu and arm-emu) due to mismatch between format specifier and data type.
../grub-core/osdep/devmapper/getroot.c: In function 'grub_util_pull_devmapper':
../grub-core/osdep/devmapper/getroot.c:265:75: error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Werror=format=]
Quoted 8 lines
../grub-core/osdep/devmapper/getroot.c:276:80: error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Werror=format=]This patch fixes the problem by casting the type of calculated offset to
grub_size_tand use platformPRIuGRUB_SIZEas format specifier.Signed-off-by Michael Chang <[email protected]>
Daniel