aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-03-29 22:34:47 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-03-29 22:34:47 +0000
commitd409c3a2f787dd2276d242d70e03b25e33436cea (patch)
treeadec7d9142ff4899bb9d0319bbbd5822359fbc0b
parentabaef6565e03b03fb750c7935737fd0309395729 (diff)
downloadbusybox-w32-d409c3a2f787dd2276d242d70e03b25e33436cea.tar.gz
busybox-w32-d409c3a2f787dd2276d242d70e03b25e33436cea.tar.bz2
busybox-w32-d409c3a2f787dd2276d242d70e03b25e33436cea.zip
- Rich Felker writes: fix invalid printf format strings
http://busybox.net/lists/busybox/2006-March/019568.html text data bss dec hex filename 900619 10316 1038724 1949659 1dbfdb busybox.oorig 900603 10316 1038724 1949643 1dbfcb busybox
-rw-r--r--coreutils/stat.c2
-rw-r--r--e2fsprogs/blkid/blkid_getsize.c2
-rw-r--r--libbb/human_readable.c6
-rw-r--r--networking/interface.c32
4 files changed, 21 insertions, 21 deletions
diff --git a/coreutils/stat.c b/coreutils/stat.c
index c845a2aa7..36e0dadf3 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -400,7 +400,7 @@ static int do_statfs(char const *filename, char const *format)
400#else 400#else
401 401
402 format = (flags & OPT_TERSE 402 format = (flags & OPT_TERSE
403 ? "%s %Lx %lu " 403 ? "%s %llx %lu "
404 : " File: \"%s\"\n" 404 : " File: \"%s\"\n"
405 " ID: %-8Lx Namelen: %-7lu "); 405 " ID: %-8Lx Namelen: %-7lu ");
406 printf(format, 406 printf(format,
diff --git a/e2fsprogs/blkid/blkid_getsize.c b/e2fsprogs/blkid/blkid_getsize.c
index 58cc7352a..3bc11e3f4 100644
--- a/e2fsprogs/blkid/blkid_getsize.c
+++ b/e2fsprogs/blkid/blkid_getsize.c
@@ -173,7 +173,7 @@ int main(int argc, char **argv)
173 perror(argv[0]); 173 perror(argv[0]);
174 174
175 bytes = blkid_get_dev_size(fd); 175 bytes = blkid_get_dev_size(fd);
176 printf("Device %s has %Ld 1k blocks.\n", argv[1], bytes >> 10); 176 printf("Device %s has %lld 1k blocks.\n", argv[1], bytes >> 10);
177 177
178 return 0; 178 return 0;
179} 179}
diff --git a/libbb/human_readable.c b/libbb/human_readable.c
index ad9025c08..cf029c0a2 100644
--- a/libbb/human_readable.c
+++ b/libbb/human_readable.c
@@ -33,8 +33,8 @@ const char *make_human_readable_str(unsigned long long size,
33{ 33{
34 /* The code will adjust for additional (appended) units. */ 34 /* The code will adjust for additional (appended) units. */
35 static const char zero_and_units[] = { '0', 0, 'k', 'M', 'G', 'T' }; 35 static const char zero_and_units[] = { '0', 0, 'k', 'M', 'G', 'T' };
36 static const char fmt[] = "%Lu"; 36 static const char fmt[] = "%llu";
37 static const char fmt_tenths[] = "%Lu.%d%c"; 37 static const char fmt_tenths[] = "%llu.%d%c";
38 38
39 static char str[21]; /* Sufficient for 64 bit unsigned integers. */ 39 static char str[21]; /* Sufficient for 64 bit unsigned integers. */
40 40
@@ -74,7 +74,7 @@ const char *make_human_readable_str(unsigned long long size,
74 if ( frac >= 5 ) { 74 if ( frac >= 5 ) {
75 ++val; 75 ++val;
76 } 76 }
77 f = "%Lu%*c" /* fmt_no_tenths */ ; 77 f = "%llu%*c" /* fmt_no_tenths */ ;
78 frac = 1; 78 frac = 1;
79 } 79 }
80#endif 80#endif
diff --git a/networking/interface.c b/networking/interface.c
index 0c395272f..e1af2bf19 100644
--- a/networking/interface.c
+++ b/networking/interface.c
@@ -1038,23 +1038,23 @@ static char *get_name(char *name, char *p)
1038 * args. */ 1038 * args. */
1039 1039
1040/* static const char * const ss_fmt[] = { */ 1040/* static const char * const ss_fmt[] = { */
1041/* "%Ln%Lu%lu%lu%lu%lu%ln%ln%Ln%Lu%lu%lu%lu%lu%lu", */ 1041/* "%lln%llu%lu%lu%lu%lu%ln%ln%lln%llu%lu%lu%lu%lu%lu", */
1042/* "%Lu%Lu%lu%lu%lu%lu%ln%ln%Lu%Lu%lu%lu%lu%lu%lu", */ 1042/* "%llu%llu%lu%lu%lu%lu%ln%ln%llu%llu%lu%lu%lu%lu%lu", */
1043/* "%Lu%Lu%lu%lu%lu%lu%lu%lu%Lu%Lu%lu%lu%lu%lu%lu%lu" */ 1043/* "%llu%llu%lu%lu%lu%lu%lu%lu%llu%llu%lu%lu%lu%lu%lu%lu" */
1044/* }; */ 1044/* }; */
1045 1045
1046 /* Lie about the size of the int pointed to for %n. */ 1046 /* Lie about the size of the int pointed to for %n. */
1047#if INT_MAX == LONG_MAX 1047#if INT_MAX == LONG_MAX
1048static const char * const ss_fmt[] = { 1048static const char * const ss_fmt[] = {
1049 "%n%Lu%u%u%u%u%n%n%n%Lu%u%u%u%u%u", 1049 "%n%llu%u%u%u%u%n%n%n%llu%u%u%u%u%u",
1050 "%Lu%Lu%u%u%u%u%n%n%Lu%Lu%u%u%u%u%u", 1050 "%llu%llu%u%u%u%u%n%n%llu%llu%u%u%u%u%u",
1051 "%Lu%Lu%u%u%u%u%u%u%Lu%Lu%u%u%u%u%u%u" 1051 "%llu%llu%u%u%u%u%u%u%llu%llu%u%u%u%u%u%u"
1052}; 1052};
1053#else 1053#else
1054static const char * const ss_fmt[] = { 1054static const char * const ss_fmt[] = {
1055 "%n%Lu%lu%lu%lu%lu%n%n%n%Lu%lu%lu%lu%lu%lu", 1055 "%n%llu%lu%lu%lu%lu%n%n%n%llu%lu%lu%lu%lu%lu",
1056 "%Lu%Lu%lu%lu%lu%lu%n%n%Lu%Lu%lu%lu%lu%lu%lu", 1056 "%llu%llu%lu%lu%lu%lu%n%n%llu%llu%lu%lu%lu%lu%lu",
1057 "%Lu%Lu%lu%lu%lu%lu%lu%lu%Lu%Lu%lu%lu%lu%lu%lu%lu" 1057 "%llu%llu%lu%lu%lu%lu%lu%lu%llu%llu%lu%lu%lu%lu%lu%lu"
1058}; 1058};
1059 1059
1060#endif 1060#endif
@@ -1748,7 +1748,7 @@ static void print_bytes_scaled(unsigned long long ull, const char *end)
1748#endif 1748#endif
1749 } while (i); 1749 } while (i);
1750 1750
1751 printf("X bytes:%Lu (%Lu.%u %sB)%s", ull, int_part, frac_part, ext, end); 1751 printf("X bytes:%llu (%llu.%u %sB)%s", ull, int_part, frac_part, ext, end);
1752} 1752}
1753 1753
1754static const char * const ife_print_flags_strs[] = { 1754static const char * const ife_print_flags_strs[] = {
@@ -1989,23 +1989,23 @@ static void ife_print(struct interface *ptr)
1989 */ 1989 */
1990 printf(" "); 1990 printf(" ");
1991 1991
1992 printf(_("RX packets:%Lu errors:%lu dropped:%lu overruns:%lu frame:%lu\n"), 1992 printf("RX packets:%llu errors:%lu dropped:%lu overruns:%lu frame:%lu\n",
1993 ptr->stats.rx_packets, ptr->stats.rx_errors, 1993 ptr->stats.rx_packets, ptr->stats.rx_errors,
1994 ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors, 1994 ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors,
1995 ptr->stats.rx_frame_errors); 1995 ptr->stats.rx_frame_errors);
1996 if (can_compress) 1996 if (can_compress)
1997 printf(_(" compressed:%lu\n"), 1997 printf(" compressed:%lu\n",
1998 ptr->stats.rx_compressed); 1998 ptr->stats.rx_compressed);
1999 printf(" "); 1999 printf(" ");
2000 printf(_("TX packets:%Lu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"), 2000 printf("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n",
2001 ptr->stats.tx_packets, ptr->stats.tx_errors, 2001 ptr->stats.tx_packets, ptr->stats.tx_errors,
2002 ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors, 2002 ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors,
2003 ptr->stats.tx_carrier_errors); 2003 ptr->stats.tx_carrier_errors);
2004 printf(_(" collisions:%lu "), ptr->stats.collisions); 2004 printf(" collisions:%lu "), ptr->stats.collisions;
2005 if (can_compress) 2005 if (can_compress)
2006 printf(_("compressed:%lu "), ptr->stats.tx_compressed); 2006 printf("compressed:%lu ", ptr->stats.tx_compressed);
2007 if (ptr->tx_queue_len != -1) 2007 if (ptr->tx_queue_len != -1)
2008 printf(_("txqueuelen:%d "), ptr->tx_queue_len); 2008 printf("txqueuelen:%d ", ptr->tx_queue_len);
2009 printf("\n R"); 2009 printf("\n R");
2010 print_bytes_scaled(ptr->stats.rx_bytes, " T"); 2010 print_bytes_scaled(ptr->stats.rx_bytes, " T");
2011 print_bytes_scaled(ptr->stats.tx_bytes, "\n"); 2011 print_bytes_scaled(ptr->stats.tx_bytes, "\n");