Message ID | 20200205094809.30185-4-ceggers@arri.de |
---|---|
State | Accepted |
Headers | show |
Series | A bunch of build fixes | expand |
On 05.02.20 10:48, Christian Eggers wrote: > off_t can be a "long long" on some platforms > > Signed-off-by: Christian Eggers <ceggers@arri.de> > --- > core/swupdate.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/core/swupdate.c b/core/swupdate.c > index 38e5a56..33e846e 100644 > --- a/core/swupdate.c > +++ b/core/swupdate.c > @@ -341,7 +341,7 @@ static int install_from_file(char *fname, int check) > } > > if (cpio_scan(fdsw, &swcfg, pos) < 0) { > - ERROR("failed to scan for pos '%ld'!", pos); > + ERROR("failed to scan for pos '%lld'!", (long long)pos); > close(fdsw); > exit(EXIT_FAILURE); > } > But I guess we are just moving the warning, and it disappears on 64bit targets and appears again on 32 bit systems. Regards, Stefano
Am Mittwoch, 5. Februar 2020, 11:04:27 CET schrieb Stefano Babic: > On 05.02.20 10:48, Christian Eggers wrote: > > off_t can be a "long long" on some platforms > > > > Signed-off-by: Christian Eggers <ceggers@arri.de> > > --- > > > > core/swupdate.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/core/swupdate.c b/core/swupdate.c > > index 38e5a56..33e846e 100644 > > --- a/core/swupdate.c > > +++ b/core/swupdate.c > > @@ -341,7 +341,7 @@ static int install_from_file(char *fname, int check) > > > > } > > > > if (cpio_scan(fdsw, &swcfg, pos) < 0) { > > > > - ERROR("failed to scan for pos '%ld'!", pos); > > + ERROR("failed to scan for pos '%lld'!", (long long)pos); > > > > close(fdsw); > > exit(EXIT_FAILURE); > > > > } > > But I guess we are just moving the warning, and it disappears on 64bit > targets and appears again on 32 bit systems. The problem is that off_t can be a "long" or "long long" depending on the platform. Always casting it to "long long" and using "%lld" should usually solve this type of problem with only the cost of using "long long" even where "long" would be sufficient. regards Christian
On 05.02.20 11:09, Christian Eggers wrote: > Am Mittwoch, 5. Februar 2020, 11:04:27 CET schrieb Stefano Babic: >> On 05.02.20 10:48, Christian Eggers wrote: >>> off_t can be a "long long" on some platforms >>> >>> Signed-off-by: Christian Eggers <ceggers@arri.de> >>> --- >>> >>> core/swupdate.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/core/swupdate.c b/core/swupdate.c >>> index 38e5a56..33e846e 100644 >>> --- a/core/swupdate.c >>> +++ b/core/swupdate.c >>> @@ -341,7 +341,7 @@ static int install_from_file(char *fname, int check) >>> >>> } >>> >>> if (cpio_scan(fdsw, &swcfg, pos) < 0) { >>> >>> - ERROR("failed to scan for pos '%ld'!", pos); >>> + ERROR("failed to scan for pos '%lld'!", (long long)pos); >>> >>> close(fdsw); >>> exit(EXIT_FAILURE); >>> >>> } >> >> But I guess we are just moving the warning, and it disappears on 64bit >> targets and appears again on 32 bit systems. > > The problem is that off_t can be a "long" or "long long" depending on the > platform. Always casting it to "long long" and using "%lld" should usually > solve this type of problem with only the cost of using "long long" even where > "long" would be sufficient. Ok, right, I have not seen you have casted. Acked-by: Stefano Babic <sbabic@denx.de> Best regards, Stefano Babic > > regards > Christian > > > > ________________________________ > [http://assets.arri.com/media/sign/2019-12-13a-ARRI-E-mail-Signatur-Parkstadt.jpg] <https://www.google.com/maps/place/Herbert-Bayer-Stra%C3%9Fe+10,+80807+M%C3%BCnchen/data=!4m2!3m1!1s0x479e74379489f045:0x4bbf0c7a9e893d66?sa=X&ved=2ahUKEwjjvdSlh8TmAhWIp4sKHe3vDlQQ8gEwAHoECAsQAQ> > > Get all the latest information from www.arri.com<https://www.arri.com/>, Facebook<https://www.facebook.com/TeamARRI>, Twitter<https://twitter.com/ARRIChannel>, Instagram<https://instagram.com/arri> and YouTube<https://www.youtube.com/user/ARRIChannel>. > > Arnold & Richter Cine Technik GmbH & Co. Betriebs KG > Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRA 57918 > Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH > Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRB 54477 > Geschäftsführer: Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger; Markus Zeiler >
diff --git a/core/swupdate.c b/core/swupdate.c index 38e5a56..33e846e 100644 --- a/core/swupdate.c +++ b/core/swupdate.c @@ -341,7 +341,7 @@ static int install_from_file(char *fname, int check) } if (cpio_scan(fdsw, &swcfg, pos) < 0) { - ERROR("failed to scan for pos '%ld'!", pos); + ERROR("failed to scan for pos '%lld'!", (long long)pos); close(fdsw); exit(EXIT_FAILURE); }
off_t can be a "long long" on some platforms Signed-off-by: Christian Eggers <ceggers@arri.de> --- core/swupdate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)