mkenvimage: Fix compiler warning
PATCH 1/1 mkenvimage: Fix compiler warning
From: Dirk Behme <[email protected]>
Fix the compiler warning
mkenvimage.c: In function ?main?:
mkenvimage.c:218: warning: format ?%ld? expects type ?long int?, but argument 3 has type ?unsigned int? mkenvimage.c:226: warning: format ?%ld? expects type ?long int?, but argument 3 has type ?unsigned int?
introduced with the commit
mkenvimage: Use mmap() when reading from a regular file 6ee39f8055680654f9cc97b98dcce9588f1ab71e
--- tools/mkenvimage.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
tools/mkenvimage.c +2 -2
@@ -213,7 +213,7 @@ int main(int argc, char **argv) filebuf =mmap (NULL ,sizeof (*envptr) * filesize,PROT_READ ,MAP_PRIVATE , txt_fd,0 );if (filebuf ==MAP_FAILED ) { -fprintf (stderr,"mmap (%ld bytes) failed: %s\n" , +fprintf (stderr,"mmap (%d bytes) failed: %s\n" ,sizeof (*envptr) * filesize,strerror (errno));fprintf (stderr,"Falling back to read()\n" );
@@ -221,7 +221,7 @@ int main(int argc, char **argv) filebuf =malloc (sizeof (*envptr) * filesize); ret =read (txt_fd, filebuf,sizeof (*envptr) * filesize);if (ret !=sizeof (*envptr) * filesize) { -fprintf (stderr,"Can't read the whole input file (%ld bytes): %s\n" , +fprintf (stderr,"Can't read the whole input file (%d bytes): %s\n" ,sizeof (*envptr) * filesize,strerror (errno));
Signature · 1 line
1.7.7.4
PATCH 1/1 mkenvimage: Fix compiler warning
Quoted 26 lines · Dirk Behme
From: Dirk Behme<[email protected]>
Fix the compiler warning
mkenvimage.c: In function ?main?:
mkenvimage.c:218: warning: format ?%ld? expects type ?long int?, but argument 3 has type ?unsigned int? mkenvimage.c:226: warning: format ?%ld? expects type ?long int?, but argument 3 has type ?unsigned int?introduced with the commit
mkenvimage: Use
mmap()when reading from a regular file6ee39f8055680654f9cc97b98dcce9588f1ab71eSigned-off-by Dirk Behme<[email protected]>CC David Wagner<[email protected]>CC Anatolij Gustschin<[email protected]>CC Mike Frysinger<[email protected]>--- tools/mkenvimage.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)tools/mkenvimage.c +0
-0
tools/mkenvimage.c int main(int argc, char **argv) · line 216
Quoted 5 lines
tools/mkenvimage.c +1
-1@@ -213,7 +213,7 @@ int main(int argc, char **argv) filebuf =mmap (NULL ,sizeof (*envptr) * filesize,PROT_READ ,MAP_PRIVATE , txt_fd,0 );if (filebuf ==MAP_FAILED ) { - fprintf(stderr, "mmap (%ld bytes) failed: %s\n", + fprintf(stderr, "mmap (%d bytes) failed: %s\n",
this patch would now trigger a -Wformat on 64-bit hosts. you should use the size_t formatter '%zu'.
tools/mkenvimage.c int main(int argc, char **argv) · line 224
Quoted 9 lines
tools/mkenvimage.c +1
-1sizeof (*envptr) * filesize, strerror(errno));fprintf (stderr,"Falling back to read()\n" );@@ -221,7 +221,7 @@ int main(int argc, char **argv) filebuf =malloc (sizeof (*envptr) * filesize); ret =read (txt_fd, filebuf,sizeof (*envptr) * filesize);if (ret !=sizeof (*envptr) * filesize) { - fprintf(stderr, "Can't read the whole input file (%ld bytes): %s\n", + fprintf(stderr, "Can't read the whole input file (%d bytes): %s\n",
ditto!
br
-h
Quoted 3 lines
tools/mkenvimage.c +0
-0sizeof (*envptr) * filesize, strerror(errno));