diff options
author | Ron Yorston <rmy@pobox.com> | 2015-07-14 14:12:05 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2015-07-14 14:12:05 +0100 |
commit | 895a1533781ca4713ef92113ab6ac5f2584ddd9d (patch) | |
tree | 49c8602e9cd733e6f6c105e94e614b8236677853 | |
parent | 535ec990c50206697852d5c25e94a959f24d86bc (diff) | |
parent | 072fc60f29ee3a4ff38f095a9ef149b2e820c8c0 (diff) | |
download | busybox-w32-895a1533781ca4713ef92113ab6ac5f2584ddd9d.tar.gz busybox-w32-895a1533781ca4713ef92113ab6ac5f2584ddd9d.tar.bz2 busybox-w32-895a1533781ca4713ef92113ab6ac5f2584ddd9d.zip |
Merge branch 'busybox' into merge
60 files changed, 313 insertions, 322 deletions
@@ -554,7 +554,7 @@ export INSTALL_PATH ?= /boot | |||
554 | # | 554 | # |
555 | # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory | 555 | # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory |
556 | # relocations required by build roots. This is not defined in the | 556 | # relocations required by build roots. This is not defined in the |
557 | # makefile but the arguement can be passed to make if needed. | 557 | # makefile but the argument can be passed to make if needed. |
558 | # | 558 | # |
559 | 559 | ||
560 | MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) | 560 | MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) |
diff --git a/Makefile.custom b/Makefile.custom index f8a12831d..891c9ced7 100644 --- a/Makefile.custom +++ b/Makefile.custom | |||
@@ -28,6 +28,10 @@ ifeq ($(CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER),y) | |||
28 | INSTALL_OPTS:= --scriptwrapper | 28 | INSTALL_OPTS:= --scriptwrapper |
29 | endif | 29 | endif |
30 | endif | 30 | endif |
31 | ifeq ($(CONFIG_FEATURE_INDIVIDUAL),y) | ||
32 | INSTALL_OPTS:= --binaries | ||
33 | LIBBUSYBOX_SONAME:= 0_lib/libbusybox.so.$(BB_VER) | ||
34 | endif | ||
31 | install: $(srctree)/applets/install.sh busybox busybox.links | 35 | install: $(srctree)/applets/install.sh busybox busybox.links |
32 | $(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \ | 36 | $(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \ |
33 | $(SHELL) $< $(CONFIG_PREFIX) $(INSTALL_OPTS) | 37 | $(SHELL) $< $(CONFIG_PREFIX) $(INSTALL_OPTS) |
diff --git a/applets/install.sh b/applets/install.sh index 95b4719d4..f6c097e57 100755 --- a/applets/install.sh +++ b/applets/install.sh | |||
@@ -5,19 +5,26 @@ export LC_CTYPE=POSIX | |||
5 | 5 | ||
6 | prefix=$1 | 6 | prefix=$1 |
7 | if [ -z "$prefix" ]; then | 7 | if [ -z "$prefix" ]; then |
8 | echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks/--scriptwrapper]" | 8 | echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks/--binaries/--scriptwrapper]" |
9 | exit 1 | 9 | exit 1 |
10 | fi | 10 | fi |
11 | 11 | ||
12 | # Source the configuration | ||
13 | . ./.config | ||
14 | |||
12 | h=`sort busybox.links | uniq` | 15 | h=`sort busybox.links | uniq` |
13 | 16 | ||
17 | sharedlib_dir="0_lib" | ||
18 | |||
14 | linkopts="" | 19 | linkopts="" |
15 | scriptwrapper="n" | 20 | scriptwrapper="n" |
21 | binaries="n" | ||
16 | cleanup="0" | 22 | cleanup="0" |
17 | noclobber="0" | 23 | noclobber="0" |
18 | case "$2" in | 24 | case "$2" in |
19 | --hardlinks) linkopts="-f";; | 25 | --hardlinks) linkopts="-f";; |
20 | --symlinks) linkopts="-fs";; | 26 | --symlinks) linkopts="-fs";; |
27 | --binaries) binaries="y";; | ||
21 | --scriptwrapper) scriptwrapper="y";swrapall="y";; | 28 | --scriptwrapper) scriptwrapper="y";swrapall="y";; |
22 | --sw-sh-hard) scriptwrapper="y";linkopts="-f";; | 29 | --sw-sh-hard) scriptwrapper="y";linkopts="-f";; |
23 | --sw-sh-sym) scriptwrapper="y";linkopts="-fs";; | 30 | --sw-sh-sym) scriptwrapper="y";linkopts="-fs";; |
@@ -40,8 +47,9 @@ if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then | |||
40 | for i in $DO_INSTALL_LIBS; do | 47 | for i in $DO_INSTALL_LIBS; do |
41 | rm -f "$prefix/$libdir/$i" || exit 1 | 48 | rm -f "$prefix/$libdir/$i" || exit 1 |
42 | if [ -f "$i" ]; then | 49 | if [ -f "$i" ]; then |
50 | echo " Installing $i to the target at $prefix/$libdir/" | ||
43 | cp -pPR "$i" "$prefix/$libdir/" || exit 1 | 51 | cp -pPR "$i" "$prefix/$libdir/" || exit 1 |
44 | chmod 0644 "$prefix/$libdir/$i" || exit 1 | 52 | chmod 0644 "$prefix/$libdir/`basename $i`" || exit 1 |
45 | fi | 53 | fi |
46 | done | 54 | done |
47 | fi | 55 | fi |
@@ -68,6 +76,7 @@ install -m 755 busybox "$prefix/bin/busybox" || exit 1 | |||
68 | 76 | ||
69 | for i in $h; do | 77 | for i in $h; do |
70 | appdir=`dirname "$i"` | 78 | appdir=`dirname "$i"` |
79 | app=`basename "$i"` | ||
71 | mkdir -p "$prefix/$appdir" || exit 1 | 80 | mkdir -p "$prefix/$appdir" || exit 1 |
72 | if [ "$scriptwrapper" = "y" ]; then | 81 | if [ "$scriptwrapper" = "y" ]; then |
73 | if [ "$swrapall" != "y" ] && [ "$i" = "/bin/sh" ]; then | 82 | if [ "$swrapall" != "y" ] && [ "$i" = "/bin/sh" ]; then |
@@ -78,6 +87,19 @@ for i in $h; do | |||
78 | chmod +x "$prefix/$i" | 87 | chmod +x "$prefix/$i" |
79 | fi | 88 | fi |
80 | echo " $prefix/$i" | 89 | echo " $prefix/$i" |
90 | elif [ "$binaries" = "y" ]; then | ||
91 | # Copy the binary over rather | ||
92 | if [ -e $sharedlib_dir/$app ]; then | ||
93 | if [ "$noclobber" = "0" ] || [ ! -e "$prefix/$i" ]; then | ||
94 | echo " Copying $sharedlib_dir/$app to $prefix/$i" | ||
95 | cp -pPR $sharedlib_dir/$app $prefix/$i || exit 1 | ||
96 | else | ||
97 | echo " $prefix/$i already exists" | ||
98 | fi | ||
99 | else | ||
100 | echo "Error: Could not find $sharedlib_dir/$app" | ||
101 | exit 1 | ||
102 | fi | ||
81 | else | 103 | else |
82 | if [ "$2" = "--hardlinks" ]; then | 104 | if [ "$2" = "--hardlinks" ]; then |
83 | bb_path="$prefix/bin/busybox" | 105 | bb_path="$prefix/bin/busybox" |
diff --git a/archival/cpio.c b/archival/cpio.c index 3cb7fdb35..a202069c4 100644 --- a/archival/cpio.c +++ b/archival/cpio.c | |||
@@ -257,7 +257,6 @@ static NOINLINE int cpio_o(void) | |||
257 | free(line); | 257 | free(line); |
258 | continue; | 258 | continue; |
259 | } | 259 | } |
260 | |||
261 | } else { /* line == NULL: EOF */ | 260 | } else { /* line == NULL: EOF */ |
262 | next_link: | 261 | next_link: |
263 | if (links) { | 262 | if (links) { |
diff --git a/archival/gzip.c b/archival/gzip.c index 42b2f0b2e..c9171304a 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -1372,7 +1372,6 @@ static void build_tree(tree_desc * desc) | |||
1372 | /* and insert the new node in the heap */ | 1372 | /* and insert the new node in the heap */ |
1373 | G2.heap[SMALLEST] = node++; | 1373 | G2.heap[SMALLEST] = node++; |
1374 | pqdownheap(tree, SMALLEST); | 1374 | pqdownheap(tree, SMALLEST); |
1375 | |||
1376 | } while (G2.heap_len >= 2); | 1375 | } while (G2.heap_len >= 2); |
1377 | 1376 | ||
1378 | G2.heap[--G2.heap_max] = G2.heap[SMALLEST]; | 1377 | G2.heap[--G2.heap_max] = G2.heap[SMALLEST]; |
@@ -1720,7 +1719,6 @@ static ulg flush_block(char *buf, ulg stored_len, int eof) | |||
1720 | 1719 | ||
1721 | copy_block(buf, (unsigned) stored_len, 0); /* without header */ | 1720 | copy_block(buf, (unsigned) stored_len, 0); /* without header */ |
1722 | G2.compressed_len = stored_len << 3; | 1721 | G2.compressed_len = stored_len << 3; |
1723 | |||
1724 | } else if (stored_len + 4 <= opt_lenb && buf != NULL) { | 1722 | } else if (stored_len + 4 <= opt_lenb && buf != NULL) { |
1725 | /* 4: two words for the lengths */ | 1723 | /* 4: two words for the lengths */ |
1726 | /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. | 1724 | /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. |
@@ -1734,7 +1732,6 @@ static ulg flush_block(char *buf, ulg stored_len, int eof) | |||
1734 | G2.compressed_len += (stored_len + 4) << 3; | 1732 | G2.compressed_len += (stored_len + 4) << 3; |
1735 | 1733 | ||
1736 | copy_block(buf, (unsigned) stored_len, 1); /* with header */ | 1734 | copy_block(buf, (unsigned) stored_len, 1); /* with header */ |
1737 | |||
1738 | } else if (static_lenb == opt_lenb) { | 1735 | } else if (static_lenb == opt_lenb) { |
1739 | send_bits((STATIC_TREES << 1) + eof, 3); | 1736 | send_bits((STATIC_TREES << 1) + eof, 3); |
1740 | compress_block((ct_data *) G2.static_ltree, (ct_data *) G2.static_dtree); | 1737 | compress_block((ct_data *) G2.static_ltree, (ct_data *) G2.static_dtree); |
diff --git a/archival/libarchive/bz/compress.c b/archival/libarchive/bz/compress.c index 23de9d3f5..2d994685c 100644 --- a/archival/libarchive/bz/compress.c +++ b/archival/libarchive/bz/compress.c | |||
@@ -385,7 +385,6 @@ void sendMTFValues(EState* s) | |||
385 | cost[0] = cost01 & 0xffff; cost[1] = cost01 >> 16; | 385 | cost[0] = cost01 & 0xffff; cost[1] = cost01 >> 16; |
386 | cost[2] = cost23 & 0xffff; cost[3] = cost23 >> 16; | 386 | cost[2] = cost23 & 0xffff; cost[3] = cost23 >> 16; |
387 | cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16; | 387 | cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16; |
388 | |||
389 | } else | 388 | } else |
390 | #endif | 389 | #endif |
391 | { | 390 | { |
diff --git a/archival/libarchive/decompress_uncompress.c b/archival/libarchive/decompress_uncompress.c index 496d864a7..034ed502d 100644 --- a/archival/libarchive/decompress_uncompress.c +++ b/archival/libarchive/decompress_uncompress.c | |||
@@ -297,7 +297,6 @@ unpack_Z_stream(transformer_state_t *xstate) | |||
297 | /* Remember previous code. */ | 297 | /* Remember previous code. */ |
298 | oldcode = incode; | 298 | oldcode = incode; |
299 | } | 299 | } |
300 | |||
301 | } while (rsize > 0); | 300 | } while (rsize > 0); |
302 | 301 | ||
303 | if (outpos > 0) { | 302 | if (outpos > 0) { |
diff --git a/archival/libarchive/lzo1x_9x.c b/archival/libarchive/lzo1x_9x.c index 2b490ae83..09ee4ba5c 100644 --- a/archival/libarchive/lzo1x_9x.c +++ b/archival/libarchive/lzo1x_9x.c | |||
@@ -71,7 +71,6 @@ typedef struct { | |||
71 | uint8_t *out; | 71 | uint8_t *out; |
72 | 72 | ||
73 | unsigned r1_lit; | 73 | unsigned r1_lit; |
74 | |||
75 | } lzo1x_999_t; | 74 | } lzo1x_999_t; |
76 | 75 | ||
77 | #define getbyte(c) ((c).ip < (c).in_end ? *((c).ip)++ : (-1)) | 76 | #define getbyte(c) ((c).ip < (c).in_end ? *((c).ip)++ : (-1)) |
diff --git a/archival/libarchive/unxz/xz_dec_lzma2.c b/archival/libarchive/unxz/xz_dec_lzma2.c index 3c2dc88b7..351251f7c 100644 --- a/archival/libarchive/unxz/xz_dec_lzma2.c +++ b/archival/libarchive/unxz/xz_dec_lzma2.c | |||
@@ -995,10 +995,8 @@ XZ_EXTERN NOINLINE enum xz_ret XZ_FUNC xz_dec_lzma2_run( | |||
995 | s->lzma2.need_props = false; | 995 | s->lzma2.need_props = false; |
996 | s->lzma2.next_sequence | 996 | s->lzma2.next_sequence |
997 | = SEQ_PROPERTIES; | 997 | = SEQ_PROPERTIES; |
998 | |||
999 | } else if (s->lzma2.need_props) { | 998 | } else if (s->lzma2.need_props) { |
1000 | return XZ_DATA_ERROR; | 999 | return XZ_DATA_ERROR; |
1001 | |||
1002 | } else { | 1000 | } else { |
1003 | s->lzma2.next_sequence | 1001 | s->lzma2.next_sequence |
1004 | = SEQ_LZMA_PREPARE; | 1002 | = SEQ_LZMA_PREPARE; |
@@ -1080,7 +1078,6 @@ XZ_EXTERN NOINLINE enum xz_ret XZ_FUNC xz_dec_lzma2_run( | |||
1080 | 1078 | ||
1081 | rc_reset(&s->rc); | 1079 | rc_reset(&s->rc); |
1082 | s->lzma2.sequence = SEQ_CONTROL; | 1080 | s->lzma2.sequence = SEQ_CONTROL; |
1083 | |||
1084 | } else if (b->out_pos == b->out_size | 1081 | } else if (b->out_pos == b->out_size |
1085 | || (b->in_pos == b->in_size | 1082 | || (b->in_pos == b->in_size |
1086 | && s->temp.size | 1083 | && s->temp.size |
diff --git a/archival/libarchive/unxz/xz_dec_stream.c b/archival/libarchive/unxz/xz_dec_stream.c index bdcbf1ba3..bf791055b 100644 --- a/archival/libarchive/unxz/xz_dec_stream.c +++ b/archival/libarchive/unxz/xz_dec_stream.c | |||
@@ -353,7 +353,6 @@ static enum xz_ret XZ_FUNC crc32_validate(struct xz_dec *s, struct xz_buf *b) | |||
353 | return XZ_DATA_ERROR; | 353 | return XZ_DATA_ERROR; |
354 | 354 | ||
355 | s->pos += 8; | 355 | s->pos += 8; |
356 | |||
357 | } while (s->pos < 32); | 356 | } while (s->pos < 32); |
358 | 357 | ||
359 | s->crc32 = 0; | 358 | s->crc32 = 0; |
@@ -753,7 +752,6 @@ XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_run(struct xz_dec *s, struct xz_buf *b) | |||
753 | b->in_pos = in_start; | 752 | b->in_pos = in_start; |
754 | b->out_pos = out_start; | 753 | b->out_pos = out_start; |
755 | } | 754 | } |
756 | |||
757 | } else if (ret == XZ_OK && in_start == b->in_pos | 755 | } else if (ret == XZ_OK && in_start == b->in_pos |
758 | && out_start == b->out_pos) { | 756 | && out_start == b->out_pos) { |
759 | if (s->allow_buf_error) | 757 | if (s->allow_buf_error) |
diff --git a/archival/unzip.c b/archival/unzip.c index d370203e8..203073434 100644 --- a/archival/unzip.c +++ b/archival/unzip.c | |||
@@ -607,7 +607,6 @@ int unzip_main(int argc, char **argv) | |||
607 | || (zaccept && !find_list_entry(zaccept, dst_fn)) | 607 | || (zaccept && !find_list_entry(zaccept, dst_fn)) |
608 | ) { /* Skip entry */ | 608 | ) { /* Skip entry */ |
609 | i = 'n'; | 609 | i = 'n'; |
610 | |||
611 | } else { | 610 | } else { |
612 | if (listing) { | 611 | if (listing) { |
613 | /* List entry */ | 612 | /* List entry */ |
@@ -669,7 +668,6 @@ int unzip_main(int argc, char **argv) | |||
669 | } | 668 | } |
670 | } | 669 | } |
671 | i = 'n'; | 670 | i = 'n'; |
672 | |||
673 | } else { | 671 | } else { |
674 | /* Extract file */ | 672 | /* Extract file */ |
675 | check_file: | 673 | check_file: |
diff --git a/console-tools/showkey.c b/console-tools/showkey.c index 69b785ec6..b7b4c32a8 100644 --- a/console-tools/showkey.c +++ b/console-tools/showkey.c | |||
@@ -83,7 +83,6 @@ int showkey_main(int argc UNUSED_PARAM, char **argv) | |||
83 | if (04 /*CTRL-D*/ == c) | 83 | if (04 /*CTRL-D*/ == c) |
84 | break; | 84 | break; |
85 | } | 85 | } |
86 | |||
87 | } else { | 86 | } else { |
88 | // we assume a PC keyboard | 87 | // we assume a PC keyboard |
89 | xioctl(STDIN_FILENO, KDGKBMODE, &kbmode); | 88 | xioctl(STDIN_FILENO, KDGKBMODE, &kbmode); |
diff --git a/coreutils/Config.src b/coreutils/Config.src index f15e03990..68857b2cc 100644 --- a/coreutils/Config.src +++ b/coreutils/Config.src | |||
@@ -11,7 +11,7 @@ config CAL | |||
11 | bool "cal" | 11 | bool "cal" |
12 | default y | 12 | default y |
13 | help | 13 | help |
14 | cal is used to display a monthly calender. | 14 | cal is used to display a monthly calendar. |
15 | 15 | ||
16 | config CATV | 16 | config CATV |
17 | bool "catv" | 17 | bool "catv" |
diff --git a/coreutils/chown.c b/coreutils/chown.c index cb07bbcbb..679c0d832 100644 --- a/coreutils/chown.c +++ b/coreutils/chown.c | |||
@@ -11,7 +11,7 @@ | |||
11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/chown.html */ | 11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/chown.html */ |
12 | 12 | ||
13 | //usage:#define chown_trivial_usage | 13 | //usage:#define chown_trivial_usage |
14 | //usage: "[-RhLHP"IF_DESKTOP("cvf")"]... OWNER[<.|:>[GROUP]] FILE..." | 14 | //usage: "[-Rh"IF_DESKTOP("LHPcvf")"]... OWNER[<.|:>[GROUP]] FILE..." |
15 | //usage:#define chown_full_usage "\n\n" | 15 | //usage:#define chown_full_usage "\n\n" |
16 | //usage: "Change the owner and/or group of each FILE to OWNER and/or GROUP\n" | 16 | //usage: "Change the owner and/or group of each FILE to OWNER and/or GROUP\n" |
17 | //usage: "\n -R Recurse" | 17 | //usage: "\n -R Recurse" |
diff --git a/coreutils/ln.c b/coreutils/ln.c index 3b822e8c7..168814801 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -134,7 +134,6 @@ int ln_main(int argc, char **argv) | |||
134 | } | 134 | } |
135 | 135 | ||
136 | free(src_name); | 136 | free(src_name); |
137 | |||
138 | } while ((++argv)[1]); | 137 | } while ((++argv)[1]); |
139 | 138 | ||
140 | return status; | 139 | return status; |
diff --git a/coreutils/shuf.c b/coreutils/shuf.c index 6d0a68fc1..9f61f2f7d 100644 --- a/coreutils/shuf.c +++ b/coreutils/shuf.c | |||
@@ -94,7 +94,7 @@ int shuf_main(int argc, char **argv) | |||
94 | *dash = '\0'; | 94 | *dash = '\0'; |
95 | lo = xatou(opt_i_str); | 95 | lo = xatou(opt_i_str); |
96 | hi = xatou(dash + 1); | 96 | hi = xatou(dash + 1); |
97 | *dash = '-'; | 97 | *dash = '-'; |
98 | if (hi < lo) { | 98 | if (hi < lo) { |
99 | bb_error_msg_and_die("bad range '%s'", opt_i_str); | 99 | bb_error_msg_and_die("bad range '%s'", opt_i_str); |
100 | } | 100 | } |
diff --git a/coreutils/stat.c b/coreutils/stat.c index 769fac078..f7fd227bb 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
@@ -374,7 +374,7 @@ static void print_it(const char *masterformat, | |||
374 | { | 374 | { |
375 | /* Create a working copy of the format string */ | 375 | /* Create a working copy of the format string */ |
376 | char *format = xstrdup(masterformat); | 376 | char *format = xstrdup(masterformat); |
377 | /* Add 2 to accomodate our conversion of the stat '%s' format string | 377 | /* Add 2 to accommodate our conversion of the stat '%s' format string |
378 | * to the printf '%llu' one. */ | 378 | * to the printf '%llu' one. */ |
379 | char *dest = xmalloc(strlen(format) + 2 + 1); | 379 | char *dest = xmalloc(strlen(format) + 2 + 1); |
380 | char *b; | 380 | char *b; |
diff --git a/coreutils/truncate.c b/coreutils/truncate.c index 0e36daba3..e5fa656c8 100644 --- a/coreutils/truncate.c +++ b/coreutils/truncate.c | |||
@@ -64,12 +64,22 @@ int truncate_main(int argc UNUSED_PARAM, char **argv) | |||
64 | 64 | ||
65 | argv += optind; | 65 | argv += optind; |
66 | while (*argv) { | 66 | while (*argv) { |
67 | int fd = xopen(*argv, flags); | 67 | int fd = open(*argv, flags); |
68 | if (ftruncate(fd, size) == -1) { | 68 | if (fd < 0) { |
69 | bb_perror_msg("%s: ftruncate", *argv); | 69 | if (errno != ENOENT || !(opts & OPT_NOCREATE)) { |
70 | ret = EXIT_FAILURE; | 70 | bb_perror_msg("%s: open", *argv); |
71 | ret = EXIT_FAILURE; | ||
72 | } | ||
73 | /* else: ENOENT && OPT_NOCREATE: | ||
74 | * do not report error, exitcode is also 0. | ||
75 | */ | ||
76 | } else { | ||
77 | if (ftruncate(fd, size) == -1) { | ||
78 | bb_perror_msg("%s: truncate", *argv); | ||
79 | ret = EXIT_FAILURE; | ||
80 | } | ||
81 | xclose(fd); | ||
71 | } | 82 | } |
72 | xclose(fd); | ||
73 | ++argv; | 83 | ++argv; |
74 | } | 84 | } |
75 | 85 | ||
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 3f1227306..7aa5c67f2 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
@@ -46,7 +46,7 @@ static void FAST_FUNC read_stduu(FILE *src_stream, FILE *dst_stream, int flags U | |||
46 | 46 | ||
47 | encoded_len = line[0] * 4 / 3; | 47 | encoded_len = line[0] * 4 / 3; |
48 | /* Check that line is not too short. (we tolerate | 48 | /* Check that line is not too short. (we tolerate |
49 | * overly _long_ line to accomodate possible extra '`'). | 49 | * overly _long_ line to accommodate possible extra '`'). |
50 | * Empty line case is also caught here. */ | 50 | * Empty line case is also caught here. */ |
51 | if (str_len <= encoded_len) { | 51 | if (str_len <= encoded_len) { |
52 | break; /* go to bb_error_msg_and_die("short file"); */ | 52 | break; /* go to bb_error_msg_and_die("short file"); */ |
diff --git a/docs/cgi/env.html b/docs/cgi/env.html index b83c750bf..66a548b46 100644 --- a/docs/cgi/env.html +++ b/docs/cgi/env.html | |||
@@ -38,7 +38,7 @@ fulfilled by the gateway program: <p> | |||
38 | 38 | ||
39 | </p><ul> | 39 | </p><ul> |
40 | <li> <a name="protocol"><code>SERVER_PROTOCOL</code></a> <p> | 40 | <li> <a name="protocol"><code>SERVER_PROTOCOL</code></a> <p> |
41 | The name and revision of the information protcol this request came | 41 | The name and revision of the information protocol this request came |
42 | in with. Format: protocol/revision </p><p> | 42 | in with. Format: protocol/revision </p><p> |
43 | 43 | ||
44 | </p></li><li> <code>SERVER_PORT</code> <p> | 44 | </p></li><li> <code>SERVER_PORT</code> <p> |
diff --git a/e2fsprogs/old_e2fsprogs/blkid/dev.c b/e2fsprogs/old_e2fsprogs/blkid/dev.c index 260e49c65..c2bbb06f3 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/dev.c +++ b/e2fsprogs/old_e2fsprogs/blkid/dev.c | |||
@@ -44,8 +44,7 @@ void blkid_free_dev(blkid_dev dev) | |||
44 | bit_tags); | 44 | bit_tags); |
45 | blkid_free_tag(tag); | 45 | blkid_free_tag(tag); |
46 | } | 46 | } |
47 | if (dev->bid_name) | 47 | free(dev->bid_name); |
48 | free(dev->bid_name); | ||
49 | free(dev); | 48 | free(dev); |
50 | } | 49 | } |
51 | 50 | ||
@@ -90,7 +89,7 @@ void blkid_debug_dump_dev(blkid_dev dev) | |||
90 | * | 89 | * |
91 | * These routines do not expose the list.h implementation, which are a | 90 | * These routines do not expose the list.h implementation, which are a |
92 | * contamination of the namespace, and which force us to reveal far, far | 91 | * contamination of the namespace, and which force us to reveal far, far |
93 | * too much of our internal implemenation. I'm not convinced I want | 92 | * too much of our internal implementation. I'm not convinced I want |
94 | * to keep list.h in the long term, anyway. It's fine for kernel | 93 | * to keep list.h in the long term, anyway. It's fine for kernel |
95 | * programming, but performance is not the #1 priority for this | 94 | * programming, but performance is not the #1 priority for this |
96 | * library, and I really don't like the tradeoff of type-safety for | 95 | * library, and I really don't like the tradeoff of type-safety for |
diff --git a/e2fsprogs/old_e2fsprogs/blkid/tag.c b/e2fsprogs/old_e2fsprogs/blkid/tag.c index 7424edeb8..f10a701d2 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/tag.c +++ b/e2fsprogs/old_e2fsprogs/blkid/tag.c | |||
@@ -230,7 +230,7 @@ errout: | |||
230 | * | 230 | * |
231 | * These routines do not expose the list.h implementation, which are a | 231 | * These routines do not expose the list.h implementation, which are a |
232 | * contamination of the namespace, and which force us to reveal far, far | 232 | * contamination of the namespace, and which force us to reveal far, far |
233 | * too much of our internal implemenation. I'm not convinced I want | 233 | * too much of our internal implementation. I'm not convinced I want |
234 | * to keep list.h in the long term, anyway. It's fine for kernel | 234 | * to keep list.h in the long term, anyway. It's fine for kernel |
235 | * programming, but performance is not the #1 priority for this | 235 | * programming, but performance is not the #1 priority for this |
236 | * library, and I really don't like the tradeoff of type-safety for | 236 | * library, and I really don't like the tradeoff of type-safety for |
diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c index 0799b64ad..b816c62b0 100644 --- a/e2fsprogs/old_e2fsprogs/e2fsck.c +++ b/e2fsprogs/old_e2fsprogs/e2fsck.c | |||
@@ -6381,7 +6381,7 @@ static int deallocate_inode_block(ext2_filsys fs, blk_t *block_nr, | |||
6381 | } | 6381 | } |
6382 | 6382 | ||
6383 | /* | 6383 | /* |
6384 | * This fuction deallocates an inode | 6384 | * This function deallocates an inode |
6385 | */ | 6385 | */ |
6386 | static void deallocate_inode(e2fsck_t ctx, ext2_ino_t ino, char* block_buf) | 6386 | static void deallocate_inode(e2fsck_t ctx, ext2_ino_t ino, char* block_buf) |
6387 | { | 6387 | { |
@@ -6447,7 +6447,7 @@ static void deallocate_inode(e2fsck_t ctx, ext2_ino_t ino, char* block_buf) | |||
6447 | } | 6447 | } |
6448 | 6448 | ||
6449 | /* | 6449 | /* |
6450 | * This fuction clears the htree flag on an inode | 6450 | * This function clears the htree flag on an inode |
6451 | */ | 6451 | */ |
6452 | static void clear_htree(e2fsck_t ctx, ext2_ino_t ino) | 6452 | static void clear_htree(e2fsck_t ctx, ext2_ino_t ino) |
6453 | { | 6453 | { |
diff --git a/e2fsprogs/old_e2fsprogs/fsck.c b/e2fsprogs/old_e2fsprogs/fsck.c index 91cce970c..87874ce71 100644 --- a/e2fsprogs/old_e2fsprogs/fsck.c +++ b/e2fsprogs/old_e2fsprogs/fsck.c | |||
@@ -354,12 +354,9 @@ static void parse_escape(char *word) | |||
354 | 354 | ||
355 | static void free_instance(struct fsck_instance *i) | 355 | static void free_instance(struct fsck_instance *i) |
356 | { | 356 | { |
357 | if (i->prog) | 357 | free(i->prog); |
358 | free(i->prog); | 358 | free(i->device); |
359 | if (i->device) | 359 | free(i->base_device); |
360 | free(i->device); | ||
361 | if (i->base_device) | ||
362 | free(i->base_device); | ||
363 | free(i); | 360 | free(i); |
364 | } | 361 | } |
365 | 362 | ||
@@ -432,8 +429,7 @@ static int parse_fstab_line(char *line, struct fs_info **ret_fs) | |||
432 | fs = create_fs_device(device, mntpnt, type ? type : "auto", opts, | 429 | fs = create_fs_device(device, mntpnt, type ? type : "auto", opts, |
433 | freq ? atoi(freq) : -1, | 430 | freq ? atoi(freq) : -1, |
434 | passno ? atoi(passno) : -1); | 431 | passno ? atoi(passno) : -1); |
435 | if (dev) | 432 | free(dev); |
436 | free(dev); | ||
437 | 433 | ||
438 | if (!fs) | 434 | if (!fs) |
439 | return -1; | 435 | return -1; |
diff --git a/editors/awk.c b/editors/awk.c index 5b8e484a7..b4b6c5f78 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
@@ -1064,12 +1064,10 @@ static uint32_t next_token(uint32_t expected) | |||
1064 | 1064 | ||
1065 | if (t_rollback) { | 1065 | if (t_rollback) { |
1066 | t_rollback = FALSE; | 1066 | t_rollback = FALSE; |
1067 | |||
1068 | } else if (concat_inserted) { | 1067 | } else if (concat_inserted) { |
1069 | concat_inserted = FALSE; | 1068 | concat_inserted = FALSE; |
1070 | t_tclass = save_tclass; | 1069 | t_tclass = save_tclass; |
1071 | t_info = save_info; | 1070 | t_info = save_info; |
1072 | |||
1073 | } else { | 1071 | } else { |
1074 | p = g_pos; | 1072 | p = g_pos; |
1075 | readnext: | 1073 | readnext: |
@@ -1085,7 +1083,6 @@ static uint32_t next_token(uint32_t expected) | |||
1085 | if (*p == '\0') { | 1083 | if (*p == '\0') { |
1086 | tc = TC_EOF; | 1084 | tc = TC_EOF; |
1087 | debug_printf_parse("%s: token found: TC_EOF\n", __func__); | 1085 | debug_printf_parse("%s: token found: TC_EOF\n", __func__); |
1088 | |||
1089 | } else if (*p == '\"') { | 1086 | } else if (*p == '\"') { |
1090 | /* it's a string */ | 1087 | /* it's a string */ |
1091 | t_string = s = ++p; | 1088 | t_string = s = ++p; |
@@ -1101,7 +1098,6 @@ static uint32_t next_token(uint32_t expected) | |||
1101 | *s = '\0'; | 1098 | *s = '\0'; |
1102 | tc = TC_STRING; | 1099 | tc = TC_STRING; |
1103 | debug_printf_parse("%s: token found:'%s' TC_STRING\n", __func__, t_string); | 1100 | debug_printf_parse("%s: token found:'%s' TC_STRING\n", __func__, t_string); |
1104 | |||
1105 | } else if ((expected & TC_REGEXP) && *p == '/') { | 1101 | } else if ((expected & TC_REGEXP) && *p == '/') { |
1106 | /* it's regexp */ | 1102 | /* it's regexp */ |
1107 | t_string = s = ++p; | 1103 | t_string = s = ++p; |
@@ -1134,7 +1130,6 @@ static uint32_t next_token(uint32_t expected) | |||
1134 | syntax_error(EMSG_UNEXP_TOKEN); | 1130 | syntax_error(EMSG_UNEXP_TOKEN); |
1135 | tc = TC_NUMBER; | 1131 | tc = TC_NUMBER; |
1136 | debug_printf_parse("%s: token found:%f TC_NUMBER\n", __func__, t_double); | 1132 | debug_printf_parse("%s: token found:%f TC_NUMBER\n", __func__, t_double); |
1137 | |||
1138 | } else { | 1133 | } else { |
1139 | /* search for something known */ | 1134 | /* search for something known */ |
1140 | tl = tokenlist; | 1135 | tl = tokenlist; |
@@ -1584,12 +1579,10 @@ static void parse_program(char *p) | |||
1584 | debug_printf_parse("%s: TC_BEGIN\n", __func__); | 1579 | debug_printf_parse("%s: TC_BEGIN\n", __func__); |
1585 | seq = &beginseq; | 1580 | seq = &beginseq; |
1586 | chain_group(); | 1581 | chain_group(); |
1587 | |||
1588 | } else if (tclass & TC_END) { | 1582 | } else if (tclass & TC_END) { |
1589 | debug_printf_parse("%s: TC_END\n", __func__); | 1583 | debug_printf_parse("%s: TC_END\n", __func__); |
1590 | seq = &endseq; | 1584 | seq = &endseq; |
1591 | chain_group(); | 1585 | chain_group(); |
1592 | |||
1593 | } else if (tclass & TC_FUNCDECL) { | 1586 | } else if (tclass & TC_FUNCDECL) { |
1594 | debug_printf_parse("%s: TC_FUNCDECL\n", __func__); | 1587 | debug_printf_parse("%s: TC_FUNCDECL\n", __func__); |
1595 | next_token(TC_FUNCTION); | 1588 | next_token(TC_FUNCTION); |
@@ -1607,7 +1600,6 @@ static void parse_program(char *p) | |||
1607 | seq = &f->body; | 1600 | seq = &f->body; |
1608 | chain_group(); | 1601 | chain_group(); |
1609 | clear_array(ahash); | 1602 | clear_array(ahash); |
1610 | |||
1611 | } else if (tclass & TC_OPSEQ) { | 1603 | } else if (tclass & TC_OPSEQ) { |
1612 | debug_printf_parse("%s: TC_OPSEQ\n", __func__); | 1604 | debug_printf_parse("%s: TC_OPSEQ\n", __func__); |
1613 | rollback_token(); | 1605 | rollback_token(); |
@@ -1622,7 +1614,6 @@ static void parse_program(char *p) | |||
1622 | chain_node(OC_PRINT); | 1614 | chain_node(OC_PRINT); |
1623 | } | 1615 | } |
1624 | cn->r.n = mainseq.last; | 1616 | cn->r.n = mainseq.last; |
1625 | |||
1626 | } else /* if (tclass & TC_GRPSTART) */ { | 1617 | } else /* if (tclass & TC_GRPSTART) */ { |
1627 | debug_printf_parse("%s: TC_GRPSTART(?)\n", __func__); | 1618 | debug_printf_parse("%s: TC_GRPSTART(?)\n", __func__); |
1628 | rollback_token(); | 1619 | rollback_token(); |
@@ -1883,13 +1874,10 @@ static void handle_special(var *v) | |||
1883 | split_f0(); | 1874 | split_f0(); |
1884 | 1875 | ||
1885 | mk_splitter(getvar_s(v), &fsplitter); | 1876 | mk_splitter(getvar_s(v), &fsplitter); |
1886 | |||
1887 | } else if (v == intvar[RS]) { | 1877 | } else if (v == intvar[RS]) { |
1888 | mk_splitter(getvar_s(v), &rsplitter); | 1878 | mk_splitter(getvar_s(v), &rsplitter); |
1889 | |||
1890 | } else if (v == intvar[IGNORECASE]) { | 1879 | } else if (v == intvar[IGNORECASE]) { |
1891 | icase = istrue(v); | 1880 | icase = istrue(v); |
1892 | |||
1893 | } else { /* $n */ | 1881 | } else { /* $n */ |
1894 | n = getvar_i(intvar[NF]); | 1882 | n = getvar_i(intvar[NF]); |
1895 | setvar_i(intvar[NF], n > v-Fields ? n : v-Fields+1); | 1883 | setvar_i(intvar[NF], n > v-Fields ? n : v-Fields+1); |
diff --git a/editors/diff.c b/editors/diff.c index c3ad31bf3..cf14b1d03 100644 --- a/editors/diff.c +++ b/editors/diff.c | |||
@@ -363,7 +363,7 @@ static void stone(const int *a, int n, const int *b, int *J, int pref) | |||
363 | } | 363 | } |
364 | 364 | ||
365 | struct line { | 365 | struct line { |
366 | /* 'serial' is not used in the begining, so we reuse it | 366 | /* 'serial' is not used in the beginning, so we reuse it |
367 | * to store line offsets, thus reducing memory pressure | 367 | * to store line offsets, thus reducing memory pressure |
368 | */ | 368 | */ |
369 | union { | 369 | union { |
diff --git a/editors/ed.c b/editors/ed.c index 3087fb0b9..f0e5e4d5d 100644 --- a/editors/ed.c +++ b/editors/ed.c | |||
@@ -732,7 +732,6 @@ static int readLines(const char *file, int num) | |||
732 | cc = safe_read(fd, bufPtr, bufSize - bufUsed); | 732 | cc = safe_read(fd, bufPtr, bufSize - bufUsed); |
733 | bufUsed += cc; | 733 | bufUsed += cc; |
734 | bufPtr = bufBase; | 734 | bufPtr = bufBase; |
735 | |||
736 | } while (cc > 0); | 735 | } while (cc > 0); |
737 | 736 | ||
738 | if (cc < 0) { | 737 | if (cc < 0) { |
diff --git a/editors/vi.c b/editors/vi.c index 3eed279e7..075f714cf 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -411,7 +411,6 @@ struct globals { | |||
411 | char undo_text[1]; // text that was deleted (if deletion) | 411 | char undo_text[1]; // text that was deleted (if deletion) |
412 | } *undo_stack_tail; | 412 | } *undo_stack_tail; |
413 | #endif /* ENABLE_FEATURE_VI_UNDO */ | 413 | #endif /* ENABLE_FEATURE_VI_UNDO */ |
414 | |||
415 | }; | 414 | }; |
416 | #define G (*ptr_to_globals) | 415 | #define G (*ptr_to_globals) |
417 | #define text (G.text ) | 416 | #define text (G.text ) |
@@ -501,7 +500,7 @@ static char *prev_line(char *); // return pointer to prev line B-o-l | |||
501 | static char *next_line(char *); // return pointer to next line B-o-l | 500 | static char *next_line(char *); // return pointer to next line B-o-l |
502 | static char *end_screen(void); // get pointer to last char on screen | 501 | static char *end_screen(void); // get pointer to last char on screen |
503 | static int count_lines(char *, char *); // count line from start to stop | 502 | static int count_lines(char *, char *); // count line from start to stop |
504 | static char *find_line(int); // find begining of line #li | 503 | static char *find_line(int); // find beginning of line #li |
505 | static char *move_to_col(char *, int); // move "p" to column l | 504 | static char *move_to_col(char *, int); // move "p" to column l |
506 | static void dot_left(void); // move dot left- dont leave line | 505 | static void dot_left(void); // move dot left- dont leave line |
507 | static void dot_right(void); // move dot right- dont leave line | 506 | static void dot_right(void); // move dot right- dont leave line |
@@ -1684,10 +1683,10 @@ static char *dollar_line(char *p) // return pointer to just before NL line | |||
1684 | 1683 | ||
1685 | static char *prev_line(char *p) // return pointer first char prev line | 1684 | static char *prev_line(char *p) // return pointer first char prev line |
1686 | { | 1685 | { |
1687 | p = begin_line(p); // goto begining of cur line | 1686 | p = begin_line(p); // goto beginning of cur line |
1688 | if (p > text && p[-1] == '\n') | 1687 | if (p > text && p[-1] == '\n') |
1689 | p--; // step to prev line | 1688 | p--; // step to prev line |
1690 | p = begin_line(p); // goto begining of prev line | 1689 | p = begin_line(p); // goto beginning of prev line |
1691 | return p; | 1690 | return p; |
1692 | } | 1691 | } |
1693 | 1692 | ||
@@ -1735,7 +1734,7 @@ static int count_lines(char *start, char *stop) | |||
1735 | return cnt; | 1734 | return cnt; |
1736 | } | 1735 | } |
1737 | 1736 | ||
1738 | static char *find_line(int li) // find begining of line #li | 1737 | static char *find_line(int li) // find beginning of line #li |
1739 | { | 1738 | { |
1740 | char *q; | 1739 | char *q; |
1741 | 1740 | ||
@@ -3404,7 +3403,7 @@ static void refresh(int full_screen) | |||
3404 | tp = t + 1; | 3403 | tp = t + 1; |
3405 | } | 3404 | } |
3406 | 3405 | ||
3407 | // see if there are any changes between vitual screen and out_buf | 3406 | // see if there are any changes between virtual screen and out_buf |
3408 | changed = FALSE; // assume no change | 3407 | changed = FALSE; // assume no change |
3409 | cs = 0; | 3408 | cs = 0; |
3410 | ce = columns - 1; | 3409 | ce = columns - 1; |
@@ -3441,7 +3440,7 @@ static void refresh(int full_screen) | |||
3441 | if (cs < 0) cs = 0; | 3440 | if (cs < 0) cs = 0; |
3442 | if (ce > columns - 1) ce = columns - 1; | 3441 | if (ce > columns - 1) ce = columns - 1; |
3443 | if (cs > ce) { cs = 0; ce = columns - 1; } | 3442 | if (cs > ce) { cs = 0; ce = columns - 1; } |
3444 | // is there a change between vitual screen and out_buf | 3443 | // is there a change between virtual screen and out_buf |
3445 | if (changed) { | 3444 | if (changed) { |
3446 | // copy changed part of buffer to virtual screen | 3445 | // copy changed part of buffer to virtual screen |
3447 | memcpy(sp+cs, out_buf+cs, ce-cs+1); | 3446 | memcpy(sp+cs, out_buf+cs, ce-cs+1); |
@@ -3891,7 +3890,7 @@ static void do_cmd(int c) | |||
3891 | } | 3890 | } |
3892 | break; | 3891 | break; |
3893 | #endif /* FEATURE_VI_SEARCH */ | 3892 | #endif /* FEATURE_VI_SEARCH */ |
3894 | case '0': // 0- goto begining of line | 3893 | case '0': // 0- goto beginning of line |
3895 | case '1': // 1- | 3894 | case '1': // 1- |
3896 | case '2': // 2- | 3895 | case '2': // 2- |
3897 | case '3': // 3- | 3896 | case '3': // 3- |
diff --git a/findutils/xargs.c b/findutils/xargs.c index e0fb369e8..1ca136128 100644 --- a/findutils/xargs.c +++ b/findutils/xargs.c | |||
@@ -154,7 +154,7 @@ static void store_param(char *s) | |||
154 | * is seen, store the address of a new parameter to args[]. | 154 | * is seen, store the address of a new parameter to args[]. |
155 | * If reading discovers that last chars do not form the complete | 155 | * If reading discovers that last chars do not form the complete |
156 | * parameter, the pointer to the first such "tail character" is returned. | 156 | * parameter, the pointer to the first such "tail character" is returned. |
157 | * (buf has extra byte at the end to accomodate terminating NUL | 157 | * (buf has extra byte at the end to accommodate terminating NUL |
158 | * of "tail characters" string). | 158 | * of "tail characters" string). |
159 | * Otherwise, the returned pointer points to NUL byte. | 159 | * Otherwise, the returned pointer points to NUL byte. |
160 | * On entry, buf[] may contain some "seed chars" which are to become | 160 | * On entry, buf[] may contain some "seed chars" which are to become |
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 06857ed61..e75257a74 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -131,7 +131,7 @@ void FAST_FUNC bb_show_usage(void) | |||
131 | full_write2_str(applet_name); | 131 | full_write2_str(applet_name); |
132 | full_write2_str(" "); | 132 | full_write2_str(" "); |
133 | full_write2_str(p); | 133 | full_write2_str(p); |
134 | full_write2_str("\n\n"); | 134 | full_write2_str("\n"); |
135 | } | 135 | } |
136 | if (ENABLE_FEATURE_CLEAN_UP) | 136 | if (ENABLE_FEATURE_CLEAN_UP) |
137 | dealloc_usage_messages((char*)usage_string); | 137 | dealloc_usage_messages((char*)usage_string); |
@@ -462,7 +462,6 @@ static void parse_config_file(void) | |||
462 | errmsg = "keyword outside section"; | 462 | errmsg = "keyword outside section"; |
463 | goto pe_label; | 463 | goto pe_label; |
464 | } | 464 | } |
465 | |||
466 | } /* while (1) */ | 465 | } /* while (1) */ |
467 | 466 | ||
468 | pe_label: | 467 | pe_label: |
diff --git a/libbb/in_ether.c b/libbb/in_ether.c index 1de383bde..161c8ea3c 100644 --- a/libbb/in_ether.c +++ b/libbb/in_ether.c | |||
@@ -51,7 +51,6 @@ int FAST_FUNC in_ether(const char *bufp, struct sockaddr *sap) | |||
51 | } while (j); | 51 | } while (j); |
52 | 52 | ||
53 | *ptr++ = val; | 53 | *ptr++ = val; |
54 | |||
55 | } while (--i); | 54 | } while (--i); |
56 | 55 | ||
57 | /* Error if we aren't at end of string */ | 56 | /* Error if we aren't at end of string */ |
diff --git a/libbb/procps.c b/libbb/procps.c index fff9f8b0b..b597b74f9 100644 --- a/libbb/procps.c +++ b/libbb/procps.c | |||
@@ -615,7 +615,6 @@ void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm) | |||
615 | buf[comm_len - 1] = ' '; | 615 | buf[comm_len - 1] = ' '; |
616 | buf[col - 1] = '\0'; | 616 | buf[col - 1] = '\0'; |
617 | } | 617 | } |
618 | |||
619 | } else { | 618 | } else { |
620 | snprintf(buf, col, "[%s]", comm); | 619 | snprintf(buf, col, "[%s]", comm); |
621 | } | 620 | } |
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index f25ce9446..0c9969640 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c | |||
@@ -207,7 +207,6 @@ off_t FAST_FUNC fdlength(int fd) | |||
207 | else bottom = pos; | 207 | else bottom = pos; |
208 | 208 | ||
209 | // If we can't, it's smaller. | 209 | // If we can't, it's smaller. |
210 | |||
211 | } else { | 210 | } else { |
212 | if (bottom == top) { | 211 | if (bottom == top) { |
213 | if (!top) return 0; | 212 | if (!top) return 0; |
diff --git a/mailutils/reformime.c b/mailutils/reformime.c index 8e7d455f6..86b2cfed3 100644 --- a/mailutils/reformime.c +++ b/mailutils/reformime.c | |||
@@ -134,7 +134,6 @@ static int parse(const char *boundary, char **argv) | |||
134 | if (strcasecmp(type + 10, "mixed") != 0) | 134 | if (strcasecmp(type + 10, "mixed") != 0) |
135 | bb_error_msg_and_die("no support of content type '%s'", type); | 135 | bb_error_msg_and_die("no support of content type '%s'", type); |
136 | parse(xfind_token(tokens, "boundary"), argv); | 136 | parse(xfind_token(tokens, "boundary"), argv); |
137 | |||
138 | } else { | 137 | } else { |
139 | /* No, process one non-multipart section */ | 138 | /* No, process one non-multipart section */ |
140 | char *end; | 139 | char *end; |
diff --git a/miscutils/crontab.c b/miscutils/crontab.c index aad242fd8..85c6623b2 100644 --- a/miscutils/crontab.c +++ b/miscutils/crontab.c | |||
@@ -170,7 +170,6 @@ int crontab_main(int argc UNUSED_PARAM, char **argv) | |||
170 | unlink(tmp_fname); | 170 | unlink(tmp_fname); |
171 | /*free(tmp_fname);*/ | 171 | /*free(tmp_fname);*/ |
172 | /*free(new_fname);*/ | 172 | /*free(new_fname);*/ |
173 | |||
174 | } /* switch */ | 173 | } /* switch */ |
175 | 174 | ||
176 | /* Bump notification file. Handle window where crond picks file up | 175 | /* Bump notification file. Handle window where crond picks file up |
diff --git a/miscutils/dc.c b/miscutils/dc.c index f94d6fa6b..9c74172ba 100644 --- a/miscutils/dc.c +++ b/miscutils/dc.c | |||
@@ -56,6 +56,12 @@ enum { STACK_SIZE = (COMMON_BUFSIZE - offsetof(struct globals, stack)) / sizeof( | |||
56 | } while (0) | 56 | } while (0) |
57 | 57 | ||
58 | 58 | ||
59 | static void check_under(void) | ||
60 | { | ||
61 | if (pointer == 0) | ||
62 | bb_error_msg_and_die("stack underflow"); | ||
63 | } | ||
64 | |||
59 | static void push(double a) | 65 | static void push(double a) |
60 | { | 66 | { |
61 | if (pointer >= STACK_SIZE) | 67 | if (pointer >= STACK_SIZE) |
@@ -65,8 +71,7 @@ static void push(double a) | |||
65 | 71 | ||
66 | static double pop(void) | 72 | static double pop(void) |
67 | { | 73 | { |
68 | if (pointer == 0) | 74 | check_under(); |
69 | bb_error_msg_and_die("stack underflow"); | ||
70 | return stack[--pointer]; | 75 | return stack[--pointer]; |
71 | } | 76 | } |
72 | 77 | ||
@@ -187,6 +192,7 @@ static void print_stack_no_pop(void) | |||
187 | 192 | ||
188 | static void print_no_pop(void) | 193 | static void print_no_pop(void) |
189 | { | 194 | { |
195 | check_under(); | ||
190 | print_base(stack[pointer-1]); | 196 | print_base(stack[pointer-1]); |
191 | } | 197 | } |
192 | 198 | ||
diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c index 7034dc9a8..38d90ff10 100644 --- a/miscutils/i2c_tools.c +++ b/miscutils/i2c_tools.c | |||
@@ -355,6 +355,13 @@ static void i2c_set_pec(int fd, int pec) | |||
355 | itoptr(pec ? 1 : 0), | 355 | itoptr(pec ? 1 : 0), |
356 | "can't set PEC"); | 356 | "can't set PEC"); |
357 | } | 357 | } |
358 | |||
359 | static void i2c_set_slave_addr(int fd, int addr, int force) | ||
360 | { | ||
361 | ioctl_or_perror_and_die(fd, force ? I2C_SLAVE_FORCE : I2C_SLAVE, | ||
362 | itoptr(addr), | ||
363 | "can't set address to 0x%02x", addr); | ||
364 | } | ||
358 | #endif /* ENABLE_I2CGET || ENABLE_I2CSET || ENABLE_I2CDUMP */ | 365 | #endif /* ENABLE_I2CGET || ENABLE_I2CSET || ENABLE_I2CDUMP */ |
359 | 366 | ||
360 | #if ENABLE_I2CGET || ENABLE_I2CSET | 367 | #if ENABLE_I2CGET || ENABLE_I2CSET |
@@ -390,13 +397,6 @@ static int i2c_dev_open(int i2cbus) | |||
390 | return fd; | 397 | return fd; |
391 | } | 398 | } |
392 | 399 | ||
393 | static void i2c_set_slave_addr(int fd, int addr, int force) | ||
394 | { | ||
395 | ioctl_or_perror_and_die(fd, force ? I2C_SLAVE_FORCE : I2C_SLAVE, | ||
396 | itoptr(addr), | ||
397 | "can't set address to 0x%02x", addr); | ||
398 | } | ||
399 | |||
400 | /* Size reducing helpers for xxx_check_funcs(). */ | 400 | /* Size reducing helpers for xxx_check_funcs(). */ |
401 | static void get_funcs_matrix(int fd, unsigned long *funcs) | 401 | static void get_funcs_matrix(int fd, unsigned long *funcs) |
402 | { | 402 | { |
@@ -816,6 +816,163 @@ int i2cset_main(int argc, char **argv) | |||
816 | #endif /* ENABLE_I2CSET */ | 816 | #endif /* ENABLE_I2CSET */ |
817 | 817 | ||
818 | #if ENABLE_I2CDUMP | 818 | #if ENABLE_I2CDUMP |
819 | static int read_block_data(int buf_fd, int mode, int *block) | ||
820 | { | ||
821 | uint8_t cblock[I2C_SMBUS_BLOCK_MAX + I2C_MAX_REGS]; | ||
822 | int res, blen = 0, tmp, i; | ||
823 | |||
824 | if (mode == I2C_SMBUS_BLOCK_DATA || mode == I2C_SMBUS_I2C_BLOCK_DATA) { | ||
825 | res = i2c_smbus_read_block_data(buf_fd, 0, cblock); | ||
826 | blen = res; | ||
827 | } else { | ||
828 | for (res = 0; res < I2C_MAX_REGS; res += tmp) { | ||
829 | tmp = i2c_smbus_read_i2c_block_data( | ||
830 | buf_fd, res, I2C_SMBUS_BLOCK_MAX, | ||
831 | cblock + res); | ||
832 | if (tmp < 0) { | ||
833 | bb_error_msg_and_die("block read failed"); | ||
834 | } | ||
835 | } | ||
836 | |||
837 | if (res >= I2C_MAX_REGS) | ||
838 | res = I2C_MAX_REGS; | ||
839 | |||
840 | for (i = 0; i < res; i++) | ||
841 | block[i] = cblock[i]; | ||
842 | |||
843 | if (mode != I2C_SMBUS_BLOCK_DATA) | ||
844 | for (i = res; i < I2C_MAX_REGS; i++) | ||
845 | block[i] = -1; | ||
846 | } | ||
847 | |||
848 | return blen; | ||
849 | } | ||
850 | |||
851 | /* Dump all but word data. */ | ||
852 | static void dump_data(int bus_fd, int mode, unsigned first, | ||
853 | unsigned last, int *block, int blen) | ||
854 | { | ||
855 | int i, j, res; | ||
856 | |||
857 | printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f" | ||
858 | " 0123456789abcdef\n"); | ||
859 | |||
860 | for (i = 0; i < I2C_MAX_REGS; i += 0x10) { | ||
861 | if (mode == I2C_SMBUS_BLOCK_DATA && i >= blen) | ||
862 | break; | ||
863 | if (i/16 < first/16) | ||
864 | continue; | ||
865 | if (i/16 > last/16) | ||
866 | break; | ||
867 | |||
868 | printf("%02x: ", i); | ||
869 | for (j = 0; j < 16; j++) { | ||
870 | fflush_all(); | ||
871 | /* Skip unwanted registers */ | ||
872 | if (i+j < first || i+j > last) { | ||
873 | printf(" "); | ||
874 | if (mode == I2C_SMBUS_WORD_DATA) { | ||
875 | printf(" "); | ||
876 | j++; | ||
877 | } | ||
878 | continue; | ||
879 | } | ||
880 | |||
881 | switch (mode) { | ||
882 | case I2C_SMBUS_BYTE_DATA: | ||
883 | res = i2c_smbus_read_byte_data(bus_fd, i+j); | ||
884 | block[i+j] = res; | ||
885 | break; | ||
886 | case I2C_SMBUS_WORD_DATA: | ||
887 | res = i2c_smbus_read_word_data(bus_fd, i+j); | ||
888 | if (res < 0) { | ||
889 | block[i+j] = res; | ||
890 | block[i+j+1] = res; | ||
891 | } else { | ||
892 | block[i+j] = res & 0xff; | ||
893 | block[i+j+1] = res >> 8; | ||
894 | } | ||
895 | break; | ||
896 | case I2C_SMBUS_BYTE: | ||
897 | res = i2c_smbus_read_byte(bus_fd); | ||
898 | block[i+j] = res; | ||
899 | break; | ||
900 | default: | ||
901 | res = block[i+j]; | ||
902 | } | ||
903 | |||
904 | if (mode == I2C_SMBUS_BLOCK_DATA && | ||
905 | i+j >= blen) { | ||
906 | printf(" "); | ||
907 | } else if (res < 0) { | ||
908 | printf("XX "); | ||
909 | if (mode == I2C_SMBUS_WORD_DATA) | ||
910 | printf("XX "); | ||
911 | } else { | ||
912 | printf("%02x ", block[i+j]); | ||
913 | if (mode == I2C_SMBUS_WORD_DATA) | ||
914 | printf("%02x ", block[i+j+1]); | ||
915 | } | ||
916 | |||
917 | if (mode == I2C_SMBUS_WORD_DATA) | ||
918 | j++; | ||
919 | } | ||
920 | printf(" "); | ||
921 | |||
922 | for (j = 0; j < 16; j++) { | ||
923 | if (mode == I2C_SMBUS_BLOCK_DATA && i+j >= blen) | ||
924 | break; | ||
925 | /* Skip unwanted registers */ | ||
926 | if (i+j < first || i+j > last) { | ||
927 | printf(" "); | ||
928 | continue; | ||
929 | } | ||
930 | |||
931 | res = block[i+j]; | ||
932 | if (res < 0) { | ||
933 | printf("X"); | ||
934 | } else if (res == 0x00 || res == 0xff) { | ||
935 | printf("."); | ||
936 | } else if (res < 32 || res >= 127) { | ||
937 | printf("?"); | ||
938 | } else { | ||
939 | printf("%c", res); | ||
940 | } | ||
941 | } | ||
942 | printf("\n"); | ||
943 | } | ||
944 | } | ||
945 | |||
946 | static void dump_word_data(int bus_fd, unsigned first, unsigned last) | ||
947 | { | ||
948 | int i, j, rv; | ||
949 | |||
950 | /* Word data. */ | ||
951 | printf(" 0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f\n"); | ||
952 | for (i = 0; i < 256; i += 8) { | ||
953 | if (i/8 < first/8) | ||
954 | continue; | ||
955 | if (i/8 > last/8) | ||
956 | break; | ||
957 | |||
958 | printf("%02x: ", i); | ||
959 | for (j = 0; j < 8; j++) { | ||
960 | /* Skip unwanted registers. */ | ||
961 | if (i+j < first || i+j > last) { | ||
962 | printf(" "); | ||
963 | continue; | ||
964 | } | ||
965 | |||
966 | rv = i2c_smbus_read_word_data(bus_fd, i+j); | ||
967 | if (rv < 0) | ||
968 | printf("XXXX "); | ||
969 | else | ||
970 | printf("%04x ", rv & 0xffff); | ||
971 | } | ||
972 | printf("\n"); | ||
973 | } | ||
974 | } | ||
975 | |||
819 | //usage:#define i2cdump_trivial_usage | 976 | //usage:#define i2cdump_trivial_usage |
820 | //usage: "[-f] [-r FIRST-LAST] [-y] BUS ADDR [MODE]" | 977 | //usage: "[-f] [-r FIRST-LAST] [-y] BUS ADDR [MODE]" |
821 | //usage:#define i2cdump_full_usage "\n\n" | 978 | //usage:#define i2cdump_full_usage "\n\n" |
@@ -842,12 +999,10 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv) | |||
842 | const char *const optstr = "fyr:"; | 999 | const char *const optstr = "fyr:"; |
843 | 1000 | ||
844 | int bus_num, bus_addr, mode = I2C_SMBUS_BYTE_DATA, even = 0, pec = 0; | 1001 | int bus_num, bus_addr, mode = I2C_SMBUS_BYTE_DATA, even = 0, pec = 0; |
845 | unsigned first = 0x00, last = 0xff; | 1002 | unsigned first = 0x00, last = 0xff, opts; |
846 | int fd, i, j, res, blen = 0, tmp; | 1003 | int *block = (int *)bb_common_bufsiz1; |
847 | unsigned char cblock[I2C_SMBUS_BLOCK_MAX + I2C_MAX_REGS]; | ||
848 | unsigned char block[I2C_SMBUS_BLOCK_MAX]; | ||
849 | char *opt_r_str, *dash; | 1004 | char *opt_r_str, *dash; |
850 | unsigned opts; | 1005 | int fd, res, blen; |
851 | 1006 | ||
852 | opt_complementary = "-2:?3"; /* from 2 to 3 args */ | 1007 | opt_complementary = "-2:?3"; /* from 2 to 3 args */ |
853 | opts = getopt32(argv, optstr, &opt_r_str); | 1008 | opts = getopt32(argv, optstr, &opt_r_str); |
@@ -858,7 +1013,7 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv) | |||
858 | 1013 | ||
859 | if (argv[2]) { | 1014 | if (argv[2]) { |
860 | switch (argv[2][0]) { | 1015 | switch (argv[2][0]) { |
861 | case 'b': /* Already set */ break; | 1016 | case 'b': /* Already set. */ break; |
862 | case 'c': mode = I2C_SMBUS_BYTE; break; | 1017 | case 'c': mode = I2C_SMBUS_BYTE; break; |
863 | case 'w': mode = I2C_SMBUS_WORD_DATA; break; | 1018 | case 'w': mode = I2C_SMBUS_WORD_DATA; break; |
864 | case 'W': | 1019 | case 'W': |
@@ -887,7 +1042,7 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv) | |||
887 | bb_error_msg_and_die("invalid range"); | 1042 | bb_error_msg_and_die("invalid range"); |
888 | last = xstrtou_range(++dash, 0, first, 0xff); | 1043 | last = xstrtou_range(++dash, 0, first, 0xff); |
889 | 1044 | ||
890 | /* Range is not available for every mode */ | 1045 | /* Range is not available for every mode. */ |
891 | switch (mode) { | 1046 | switch (mode) { |
892 | case I2C_SMBUS_BYTE: | 1047 | case I2C_SMBUS_BYTE: |
893 | case I2C_SMBUS_BYTE_DATA: | 1048 | case I2C_SMBUS_BYTE_DATA: |
@@ -912,156 +1067,19 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv) | |||
912 | if (!(opts & opt_y)) | 1067 | if (!(opts & opt_y)) |
913 | confirm_action(bus_addr, mode, -1 /* data_addr */, pec); | 1068 | confirm_action(bus_addr, mode, -1 /* data_addr */, pec); |
914 | 1069 | ||
915 | /* All but word data */ | 1070 | /* All but word data. */ |
916 | if (mode != I2C_SMBUS_WORD_DATA || even) { | 1071 | if (mode != I2C_SMBUS_WORD_DATA || even) { |
917 | /* | 1072 | blen = read_block_data(fd, mode, block); |
918 | * FIXME This section has been ported from upstream i2cdump. | ||
919 | * It has been reworked a bit but is still pretty spaghetti | ||
920 | * and needs splitting into several functions. | ||
921 | */ | ||
922 | if (mode == I2C_SMBUS_BLOCK_DATA || | ||
923 | mode == I2C_SMBUS_I2C_BLOCK_DATA) { | ||
924 | res = i2c_smbus_read_block_data(fd, 0, cblock); | ||
925 | blen = res; | ||
926 | } else { | ||
927 | for (res = 0; res < I2C_MAX_REGS; res += tmp) { | ||
928 | tmp = i2c_smbus_read_i2c_block_data( | ||
929 | fd, res, I2C_SMBUS_BLOCK_MAX, | ||
930 | cblock + res); | ||
931 | if (tmp < 0) { | ||
932 | bb_error_msg_and_die( | ||
933 | "block read failed"); | ||
934 | } | ||
935 | } | ||
936 | if (res >= I2C_MAX_REGS) | ||
937 | res = I2C_MAX_REGS; | ||
938 | for (i = 0; i < res; i++) | ||
939 | block[i] = cblock[i]; | ||
940 | if (mode != I2C_SMBUS_BLOCK_DATA) | ||
941 | for (i = res; i < I2C_MAX_REGS; i++) | ||
942 | cblock[i] = -1; | ||
943 | } | ||
944 | 1073 | ||
945 | if (mode == I2C_SMBUS_BYTE) { | 1074 | if (mode == I2C_SMBUS_BYTE) { |
946 | res = i2c_smbus_write_byte(fd, first); | 1075 | res = i2c_smbus_write_byte(fd, first); |
947 | if (res < 0) | 1076 | if (res < 0) |
948 | bb_perror_msg_and_die( | 1077 | bb_perror_msg_and_die("write start address"); |
949 | "write start address failed"); | ||
950 | } | 1078 | } |
951 | 1079 | ||
952 | printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f" | 1080 | dump_data(fd, mode, first, last, block, blen); |
953 | " 0123456789abcdef\n"); | ||
954 | |||
955 | for (i = 0; i < I2C_MAX_REGS; i += 0x10) { | ||
956 | if (mode == I2C_SMBUS_BLOCK_DATA && i >= blen) | ||
957 | break; | ||
958 | if (i/16 < first/16) | ||
959 | continue; | ||
960 | if (i/16 > last/16) | ||
961 | break; | ||
962 | |||
963 | printf("%02x: ", i); | ||
964 | for (j = 0; j < 16; j++) { | ||
965 | fflush_all(); | ||
966 | /* Skip unwanted registers */ | ||
967 | if (i+j < first || i+j > last) { | ||
968 | printf(" "); | ||
969 | if (mode == I2C_SMBUS_WORD_DATA) { | ||
970 | printf(" "); | ||
971 | j++; | ||
972 | } | ||
973 | continue; | ||
974 | } | ||
975 | |||
976 | switch (mode) { | ||
977 | case I2C_SMBUS_BYTE_DATA: | ||
978 | res = i2c_smbus_read_byte_data(fd, i+j); | ||
979 | block[i+j] = res; | ||
980 | break; | ||
981 | case I2C_SMBUS_WORD_DATA: | ||
982 | res = i2c_smbus_read_word_data(fd, i+j); | ||
983 | if (res < 0) { | ||
984 | block[i+j] = res; | ||
985 | block[i+j+1] = res; | ||
986 | } else { | ||
987 | block[i+j] = res & 0xff; | ||
988 | block[i+j+1] = res >> 8; | ||
989 | } | ||
990 | break; | ||
991 | case I2C_SMBUS_BYTE: | ||
992 | res = i2c_smbus_read_byte(fd); | ||
993 | block[i+j] = res; | ||
994 | break; | ||
995 | default: | ||
996 | res = block[i+j]; | ||
997 | } | ||
998 | |||
999 | if (mode == I2C_SMBUS_BLOCK_DATA && | ||
1000 | i+j >= blen) { | ||
1001 | printf(" "); | ||
1002 | } else if (res < 0) { | ||
1003 | printf("XX "); | ||
1004 | if (mode == I2C_SMBUS_WORD_DATA) | ||
1005 | printf("XX "); | ||
1006 | } else { | ||
1007 | printf("%02x ", block[i+j]); | ||
1008 | if (mode == I2C_SMBUS_WORD_DATA) | ||
1009 | printf("%02x ", block[i+j+1]); | ||
1010 | } | ||
1011 | |||
1012 | if (mode == I2C_SMBUS_WORD_DATA) | ||
1013 | j++; | ||
1014 | } | ||
1015 | printf(" "); | ||
1016 | |||
1017 | for (j = 0; j < 16; j++) { | ||
1018 | if (mode == I2C_SMBUS_BLOCK_DATA && i+j >= blen) | ||
1019 | break; | ||
1020 | /* Skip unwanted registers */ | ||
1021 | if (i+j < first || i+j > last) { | ||
1022 | printf(" "); | ||
1023 | continue; | ||
1024 | } | ||
1025 | |||
1026 | res = block[i+j]; | ||
1027 | if (res < 0) { | ||
1028 | //FIXME: impossible, block[] is uchar[] | ||
1029 | printf("X"); | ||
1030 | } else if (res == 0x00 || res == 0xff) { | ||
1031 | printf("."); | ||
1032 | } else if (res < 32 || res >= 127) { | ||
1033 | printf("?"); | ||
1034 | } else { | ||
1035 | printf("%c", res); | ||
1036 | } | ||
1037 | } | ||
1038 | printf("\n"); | ||
1039 | } | ||
1040 | } else { | 1081 | } else { |
1041 | /* Word data. */ | 1082 | dump_word_data(fd, first, last); |
1042 | printf(" 0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f\n"); | ||
1043 | for (i = 0; i < 256; i += 8) { | ||
1044 | if (i/8 < first/8) | ||
1045 | continue; | ||
1046 | if (i/8 > last/8) | ||
1047 | break; | ||
1048 | |||
1049 | printf("%02x: ", i); | ||
1050 | for (j = 0; j < 8; j++) { | ||
1051 | /* Skip unwanted registers. */ | ||
1052 | if (i+j < first || i+j > last) { | ||
1053 | printf(" "); | ||
1054 | continue; | ||
1055 | } | ||
1056 | |||
1057 | res = i2c_smbus_read_word_data(fd, i+j); | ||
1058 | if (res < 0) | ||
1059 | printf("XXXX "); | ||
1060 | else | ||
1061 | printf("%04x ", res & 0xffff); | ||
1062 | } | ||
1063 | printf("\n"); | ||
1064 | } | ||
1065 | } | 1083 | } |
1066 | 1084 | ||
1067 | return 0; | 1085 | return 0; |
@@ -1208,12 +1226,11 @@ static void NORETURN list_i2c_busses_and_exit(void) | |||
1208 | i2cdev_path, de->d_name, | 1226 | i2cdev_path, de->d_name, |
1209 | subde->d_name); | 1227 | subde->d_name); |
1210 | fp = fopen(path, "r"); | 1228 | fp = fopen(path, "r"); |
1211 | goto found; | 1229 | break; |
1212 | } | 1230 | } |
1213 | } | 1231 | } |
1214 | } | 1232 | } |
1215 | 1233 | ||
1216 | found: | ||
1217 | if (fp != NULL) { | 1234 | if (fp != NULL) { |
1218 | /* | 1235 | /* |
1219 | * Get the rest of the info and display a line | 1236 | * Get the rest of the info and display a line |
@@ -1281,11 +1298,9 @@ int i2cdetect_main(int argc UNUSED_PARAM, char **argv) | |||
1281 | opt_F = (1 << 4), opt_l = (1 << 5); | 1298 | opt_F = (1 << 4), opt_l = (1 << 5); |
1282 | const char *const optstr = "yaqrFl"; | 1299 | const char *const optstr = "yaqrFl"; |
1283 | 1300 | ||
1284 | int fd, bus_num, i, j, mode = DETECT_MODE_AUTO; | 1301 | int fd, bus_num, i, j, mode = DETECT_MODE_AUTO, status; |
1285 | int status; | 1302 | unsigned first = 0x03, last = 0x77, opts; |
1286 | unsigned first = 0x00, last = 0x77; | ||
1287 | unsigned long funcs; | 1303 | unsigned long funcs; |
1288 | unsigned opts; | ||
1289 | 1304 | ||
1290 | opt_complementary = "q--r:r--q:" /* mutually exclusive */ | 1305 | opt_complementary = "q--r:r--q:" /* mutually exclusive */ |
1291 | "?3"; /* up to 3 args */ | 1306 | "?3"; /* up to 3 args */ |
@@ -1318,8 +1333,10 @@ int i2cdetect_main(int argc UNUSED_PARAM, char **argv) | |||
1318 | else if (opts & opt_q) | 1333 | else if (opts & opt_q) |
1319 | mode = DETECT_MODE_QUICK; | 1334 | mode = DETECT_MODE_QUICK; |
1320 | 1335 | ||
1321 | if (opts & opt_a) | 1336 | if (opts & opt_a) { |
1337 | first = 0x00; | ||
1322 | last = 0x7f; | 1338 | last = 0x7f; |
1339 | } | ||
1323 | 1340 | ||
1324 | /* Read address range. */ | 1341 | /* Read address range. */ |
1325 | if (argv[1]) { | 1342 | if (argv[1]) { |
@@ -1336,7 +1353,9 @@ int i2cdetect_main(int argc UNUSED_PARAM, char **argv) | |||
1336 | } else | 1353 | } else |
1337 | if (mode == DETECT_MODE_READ && !(funcs & I2C_FUNC_SMBUS_READ_BYTE)) { | 1354 | if (mode == DETECT_MODE_READ && !(funcs & I2C_FUNC_SMBUS_READ_BYTE)) { |
1338 | no_support("SMBus Receive Byte command"); | 1355 | no_support("SMBus Receive Byte command"); |
1339 | } else { | 1356 | } |
1357 | |||
1358 | if (mode == DETECT_MODE_AUTO) { | ||
1340 | if (!(funcs & I2C_FUNC_SMBUS_QUICK)) | 1359 | if (!(funcs & I2C_FUNC_SMBUS_QUICK)) |
1341 | will_skip("SMBus Quick Write"); | 1360 | will_skip("SMBus Quick Write"); |
1342 | if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE)) | 1361 | if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE)) |
@@ -1370,7 +1389,16 @@ int i2cdetect_main(int argc UNUSED_PARAM, char **argv) | |||
1370 | continue; | 1389 | continue; |
1371 | } | 1390 | } |
1372 | 1391 | ||
1373 | i2c_set_slave_addr(fd, i + j, 0); | 1392 | status = ioctl(fd, I2C_SLAVE, itoptr(i + j)); |
1393 | if (status < 0) { | ||
1394 | if (errno == EBUSY) { | ||
1395 | printf("UU "); | ||
1396 | continue; | ||
1397 | } | ||
1398 | |||
1399 | bb_perror_msg_and_die( | ||
1400 | "can't set address to 0x%02x", i + j); | ||
1401 | } | ||
1374 | 1402 | ||
1375 | switch (mode) { | 1403 | switch (mode) { |
1376 | case DETECT_MODE_READ: | 1404 | case DETECT_MODE_READ: |
diff --git a/miscutils/less.c b/miscutils/less.c index 554e54687..d5a68d1e1 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -1848,7 +1848,7 @@ key and/or command line switch compatibility is a good idea: | |||
1848 | Most options may be changed either on the command line, | 1848 | Most options may be changed either on the command line, |
1849 | or from within less by using the - or -- command. | 1849 | or from within less by using the - or -- command. |
1850 | Options may be given in one of two forms: either a single | 1850 | Options may be given in one of two forms: either a single |
1851 | character preceded by a -, or a name preceeded by --. | 1851 | character preceded by a -, or a name preceded by --. |
1852 | -? ........ --help | 1852 | -? ........ --help |
1853 | Display help (from command line). | 1853 | Display help (from command line). |
1854 | -a ........ --search-skip-screen | 1854 | -a ........ --search-skip-screen |
diff --git a/networking/arp.c b/networking/arp.c index e79b1b6a1..0099aa534 100644 --- a/networking/arp.c +++ b/networking/arp.c | |||
@@ -68,7 +68,6 @@ struct globals { | |||
68 | const struct hwtype *hw; /* current hardware type */ | 68 | const struct hwtype *hw; /* current hardware type */ |
69 | const char *device; /* current device */ | 69 | const char *device; /* current device */ |
70 | smallint hw_set; /* flag if hw-type was set (-H) */ | 70 | smallint hw_set; /* flag if hw-type was set (-H) */ |
71 | |||
72 | } FIX_ALIASING; | 71 | } FIX_ALIASING; |
73 | #define G (*(struct globals*)&bb_common_bufsiz1) | 72 | #define G (*(struct globals*)&bb_common_bufsiz1) |
74 | #define ap (G.ap ) | 73 | #define ap (G.ap ) |
diff --git a/networking/ip.c b/networking/ip.c index 98fe621b1..d35345c36 100644 --- a/networking/ip.c +++ b/networking/ip.c | |||
@@ -33,7 +33,7 @@ | |||
33 | //usage: "{ {add|del} IFADDR dev STRING | {show|flush}\n" | 33 | //usage: "{ {add|del} IFADDR dev STRING | {show|flush}\n" |
34 | //usage: " [dev STRING] [to PREFIX] }" | 34 | //usage: " [dev STRING] [to PREFIX] }" |
35 | //usage:#define ipaddr_full_usage "\n\n" | 35 | //usage:#define ipaddr_full_usage "\n\n" |
36 | //usage: "ipaddr {add|delete} IFADDR dev STRING\n" | 36 | //usage: "ipaddr {add|change|replace|delete} IFADDR dev STRING\n" |
37 | //usage: "ipaddr {show|flush} [dev STRING] [scope SCOPE-ID]\n" | 37 | //usage: "ipaddr {show|flush} [dev STRING] [scope SCOPE-ID]\n" |
38 | //usage: " [to PREFIX] [label PATTERN]\n" | 38 | //usage: " [to PREFIX] [label PATTERN]\n" |
39 | //usage: " IFADDR := PREFIX | ADDR peer PREFIX\n" | 39 | //usage: " IFADDR := PREFIX | ADDR peer PREFIX\n" |
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index 4072d0626..a6d5129e7 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c | |||
@@ -598,7 +598,7 @@ static int default_scope(inet_prefix *lcl) | |||
598 | } | 598 | } |
599 | 599 | ||
600 | /* Return value becomes exitcode. It's okay to not return at all */ | 600 | /* Return value becomes exitcode. It's okay to not return at all */ |
601 | static int ipaddr_modify(int cmd, char **argv) | 601 | static int ipaddr_modify(int cmd, int flags, char **argv) |
602 | { | 602 | { |
603 | static const char option[] ALIGN1 = | 603 | static const char option[] ALIGN1 = |
604 | "peer\0""remote\0""broadcast\0""brd\0" | 604 | "peer\0""remote\0""broadcast\0""brd\0" |
@@ -622,7 +622,7 @@ static int ipaddr_modify(int cmd, char **argv) | |||
622 | memset(&req, 0, sizeof(req)); | 622 | memset(&req, 0, sizeof(req)); |
623 | 623 | ||
624 | req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifaddrmsg)); | 624 | req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifaddrmsg)); |
625 | req.n.nlmsg_flags = NLM_F_REQUEST; | 625 | req.n.nlmsg_flags = NLM_F_REQUEST | flags; |
626 | req.n.nlmsg_type = cmd; | 626 | req.n.nlmsg_type = cmd; |
627 | req.ifa.ifa_family = preferred_family; | 627 | req.ifa.ifa_family = preferred_family; |
628 | 628 | ||
@@ -749,16 +749,24 @@ static int ipaddr_modify(int cmd, char **argv) | |||
749 | int FAST_FUNC do_ipaddr(char **argv) | 749 | int FAST_FUNC do_ipaddr(char **argv) |
750 | { | 750 | { |
751 | static const char commands[] ALIGN1 = | 751 | static const char commands[] ALIGN1 = |
752 | "add\0""delete\0""list\0""show\0""lst\0""flush\0"; | 752 | /* 0 1 2 3 4 5 6 7 8 */ |
753 | "add\0""change\0""chg\0""replace\0""delete\0""list\0""show\0""lst\0""flush\0"; | ||
753 | int cmd = 2; | 754 | int cmd = 2; |
754 | if (*argv) { | 755 | if (*argv) { |
755 | cmd = index_in_substrings(commands, *argv); | 756 | cmd = index_in_substrings(commands, *argv); |
756 | if (cmd < 0) | 757 | if (cmd < 0) |
757 | invarg(*argv, applet_name); | 758 | invarg(*argv, applet_name); |
758 | argv++; | 759 | argv++; |
759 | if (cmd <= 1) | 760 | if (cmd <= 4) { |
760 | return ipaddr_modify((cmd == 0) ? RTM_NEWADDR : RTM_DELADDR, argv); | 761 | return ipaddr_modify( |
762 | /*cmd:*/ cmd == 4 ? RTM_DELADDR : RTM_NEWADDR, | ||
763 | /*flags:*/ | ||
764 | cmd == 0 ? NLM_F_CREATE|NLM_F_EXCL : /* add */ | ||
765 | cmd == 1 || cmd == 2 ? NLM_F_REPLACE : /* change */ | ||
766 | cmd == 3 ? NLM_F_CREATE|NLM_F_REPLACE : /* replace */ | ||
767 | 0 /* delete */ | ||
768 | , argv); | ||
769 | } | ||
761 | } | 770 | } |
762 | /* 2 == list, 3 == show, 4 == lst */ | 771 | return ipaddr_list_or_flush(argv, cmd == 8); |
763 | return ipaddr_list_or_flush(argv, cmd == 5); | ||
764 | } | 772 | } |
diff --git a/networking/netstat.c b/networking/netstat.c index 1303d3f3d..2196d42f7 100644 --- a/networking/netstat.c +++ b/networking/netstat.c | |||
@@ -119,7 +119,7 @@ typedef enum { | |||
119 | #define ADDR_NORMAL_WIDTH 23 | 119 | #define ADDR_NORMAL_WIDTH 23 |
120 | /* When there are IPv6 connections the IPv6 addresses will be | 120 | /* When there are IPv6 connections the IPv6 addresses will be |
121 | * truncated to none-recognition. The '-W' option makes the | 121 | * truncated to none-recognition. The '-W' option makes the |
122 | * address columns wide enough to accomodate for longest possible | 122 | * address columns wide enough to accommodate for longest possible |
123 | * IPv6 addresses, i.e. addresses of the form | 123 | * IPv6 addresses, i.e. addresses of the form |
124 | * xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:ddd.ddd.ddd.ddd | 124 | * xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:ddd.ddd.ddd.ddd |
125 | */ | 125 | */ |
diff --git a/networking/ntpd.c b/networking/ntpd.c index 0233ed82c..b5120a70d 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c | |||
@@ -1497,7 +1497,6 @@ update_local_clock(peer_t *p) | |||
1497 | #endif | 1497 | #endif |
1498 | abs_offset = offset = 0; | 1498 | abs_offset = offset = 0; |
1499 | set_new_values(STATE_SYNC, offset, recv_time); | 1499 | set_new_values(STATE_SYNC, offset, recv_time); |
1500 | |||
1501 | } else { /* abs_offset <= STEP_THRESHOLD */ | 1500 | } else { /* abs_offset <= STEP_THRESHOLD */ |
1502 | 1501 | ||
1503 | /* The ratio is calculated before jitter is updated to make | 1502 | /* The ratio is calculated before jitter is updated to make |
diff --git a/networking/tc.c b/networking/tc.c index 533f7c042..76e2e8359 100644 --- a/networking/tc.c +++ b/networking/tc.c | |||
@@ -151,17 +151,17 @@ static void print_rate(char *buf, int len, uint32_t rate) | |||
151 | double tmp = (double)rate*8; | 151 | double tmp = (double)rate*8; |
152 | 152 | ||
153 | if (use_iec) { | 153 | if (use_iec) { |
154 | if (tmp >= 1000.0*1024.0*1024.0) | 154 | if (tmp >= 1000*1024*1024) |
155 | snprintf(buf, len, "%.0fMibit", tmp/1024.0*1024.0); | 155 | snprintf(buf, len, "%.0fMibit", tmp/(1024*1024)); |
156 | else if (tmp >= 1000.0*1024) | 156 | else if (tmp >= 1000*1024) |
157 | snprintf(buf, len, "%.0fKibit", tmp/1024); | 157 | snprintf(buf, len, "%.0fKibit", tmp/1024); |
158 | else | 158 | else |
159 | snprintf(buf, len, "%.0fbit", tmp); | 159 | snprintf(buf, len, "%.0fbit", tmp); |
160 | } else { | 160 | } else { |
161 | if (tmp >= 1000.0*1000000.0) | 161 | if (tmp >= 1000*1000000) |
162 | snprintf(buf, len, "%.0fMbit", tmp/1000000.0); | 162 | snprintf(buf, len, "%.0fMbit", tmp/1000000); |
163 | else if (tmp >= 1000.0 * 1000.0) | 163 | else if (tmp >= 1000*1000) |
164 | snprintf(buf, len, "%.0fKbit", tmp/1000.0); | 164 | snprintf(buf, len, "%.0fKbit", tmp/1000); |
165 | else | 165 | else |
166 | snprintf(buf, len, "%.0fbit", tmp); | 166 | snprintf(buf, len, "%.0fbit", tmp); |
167 | } | 167 | } |
diff --git a/networking/tftp.c b/networking/tftp.c index 7c0ee58d7..8ecd7bb6f 100644 --- a/networking/tftp.c +++ b/networking/tftp.c | |||
@@ -348,7 +348,6 @@ static int tftp_protocol( | |||
348 | * as if it is "block 0" */ | 348 | * as if it is "block 0" */ |
349 | block_nr = 0; | 349 | block_nr = 0; |
350 | } | 350 | } |
351 | |||
352 | } else { /* tftp */ | 351 | } else { /* tftp */ |
353 | /* Open file (must be after changing user) */ | 352 | /* Open file (must be after changing user) */ |
354 | local_fd = CMD_GET(option_mask32) ? STDOUT_FILENO : STDIN_FILENO; | 353 | local_fd = CMD_GET(option_mask32) ? STDOUT_FILENO : STDIN_FILENO; |
diff --git a/networking/wget.c b/networking/wget.c index 42bfbb206..e09bd2368 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -1062,7 +1062,6 @@ However, in real world it was observed that some web servers | |||
1062 | 1062 | ||
1063 | /* For HTTP, data is pumped over the same connection */ | 1063 | /* For HTTP, data is pumped over the same connection */ |
1064 | dfp = sfp; | 1064 | dfp = sfp; |
1065 | |||
1066 | } else { | 1065 | } else { |
1067 | /* | 1066 | /* |
1068 | * FTP session | 1067 | * FTP session |
diff --git a/procps/ps.c b/procps/ps.c index 9fca3524e..07ff7568f 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -670,8 +670,8 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
670 | OPT_l = (1 << ENABLE_SELINUX) * (1 << ENABLE_FEATURE_SHOW_THREADS) * ENABLE_FEATURE_PS_LONG, | 670 | OPT_l = (1 << ENABLE_SELINUX) * (1 << ENABLE_FEATURE_SHOW_THREADS) * ENABLE_FEATURE_PS_LONG, |
671 | }; | 671 | }; |
672 | #if ENABLE_FEATURE_PS_LONG | 672 | #if ENABLE_FEATURE_PS_LONG |
673 | time_t now = now; | 673 | time_t now = now; /* for compiler */ |
674 | unsigned long uptime; | 674 | unsigned long uptime = uptime; |
675 | #endif | 675 | #endif |
676 | /* If we support any options, parse argv */ | 676 | /* If we support any options, parse argv */ |
677 | #if ENABLE_SELINUX || ENABLE_FEATURE_SHOW_THREADS || ENABLE_FEATURE_PS_WIDE || ENABLE_FEATURE_PS_LONG | 677 | #if ENABLE_SELINUX || ENABLE_FEATURE_SHOW_THREADS || ENABLE_FEATURE_PS_WIDE || ENABLE_FEATURE_PS_LONG |
@@ -802,9 +802,11 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
802 | 802 | ||
803 | { | 803 | { |
804 | int sz = terminal_width - len; | 804 | int sz = terminal_width - len; |
805 | char buf[sz + 1]; | 805 | if (sz >= 0) { |
806 | read_cmdline(buf, sz, p->pid, p->comm); | 806 | char buf[sz + 1]; |
807 | puts(buf); | 807 | read_cmdline(buf, sz, p->pid, p->comm); |
808 | puts(buf); | ||
809 | } | ||
808 | } | 810 | } |
809 | } | 811 | } |
810 | if (ENABLE_FEATURE_CLEAN_UP) | 812 | if (ENABLE_FEATURE_CLEAN_UP) |
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c index 7f21443c1..720098a23 100644 --- a/scripts/basic/docproc.c +++ b/scripts/basic/docproc.c | |||
@@ -264,7 +264,7 @@ void singfunc(char * filename, char * line) | |||
264 | vec[idx++] = KERNELDOC; | 264 | vec[idx++] = KERNELDOC; |
265 | vec[idx++] = DOCBOOK; | 265 | vec[idx++] = DOCBOOK; |
266 | 266 | ||
267 | /* Split line up in individual parameters preceeded by FUNCTION */ | 267 | /* Split line up in individual parameters preceded by FUNCTION */ |
268 | for (i=0; line[i]; i++) { | 268 | for (i=0; line[i]; i++) { |
269 | if (isspace(line[i])) { | 269 | if (isspace(line[i])) { |
270 | line[i] = '\0'; | 270 | line[i] = '\0'; |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 303df0be7..8f4ecbd33 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -124,8 +124,7 @@ int conf_read_simple(const char *name) | |||
124 | case S_INT: | 124 | case S_INT: |
125 | case S_HEX: | 125 | case S_HEX: |
126 | case S_STRING: | 126 | case S_STRING: |
127 | if (sym->user.val) | 127 | free(sym->user.val); |
128 | free(sym->user.val); | ||
129 | default: | 128 | default: |
130 | sym->user.val = NULL; | 129 | sym->user.val = NULL; |
131 | sym->user.tri = no; | 130 | sym->user.tri = no; |
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index 263091945..13369e6a1 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c | |||
@@ -79,8 +79,7 @@ struct gstr str_assign(const char *s) | |||
79 | /* Free storage for growable string */ | 79 | /* Free storage for growable string */ |
80 | void str_free(struct gstr *gs) | 80 | void str_free(struct gstr *gs) |
81 | { | 81 | { |
82 | if (gs->s) | 82 | free(gs->s); |
83 | free(gs->s); | ||
84 | gs->s = NULL; | 83 | gs->s = NULL; |
85 | gs->len = 0; | 84 | gs->len = 0; |
86 | } | 85 | } |
diff --git a/selinux/Config.src b/selinux/Config.src index 47d15b6af..d4701f60b 100644 --- a/selinux/Config.src +++ b/selinux/Config.src | |||
@@ -64,7 +64,7 @@ config RUNCON | |||
64 | default n | 64 | default n |
65 | depends on SELINUX | 65 | depends on SELINUX |
66 | help | 66 | help |
67 | Enable support to run command in speficied security context. | 67 | Enable support to run command in specified security context. |
68 | 68 | ||
69 | config FEATURE_RUNCON_LONG_OPTIONS | 69 | config FEATURE_RUNCON_LONG_OPTIONS |
70 | bool "Enable long options" | 70 | bool "Enable long options" |
diff --git a/selinux/setfiles.c b/selinux/setfiles.c index 0173db99e..c974c4a9d 100644 --- a/selinux/setfiles.c +++ b/selinux/setfiles.c | |||
@@ -251,7 +251,6 @@ static int match(const char *name, struct stat *sb, char **con) | |||
251 | name = path; | 251 | name = path; |
252 | if (excludeCtr > 0 && exclude(name)) | 252 | if (excludeCtr > 0 && exclude(name)) |
253 | goto err; | 253 | goto err; |
254 | |||
255 | } else { | 254 | } else { |
256 | char *p; | 255 | char *p; |
257 | p = realpath(name, path); | 256 | p = realpath(name, path); |
diff --git a/shell/ash.c b/shell/ash.c index c5b9741d6..ef3f7933a 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -9888,7 +9888,6 @@ evalcommand(union node *cmd, int flags) | |||
9888 | if (evalfun(cmdentry.u.func, argc, argv, flags)) | 9888 | if (evalfun(cmdentry.u.func, argc, argv, flags)) |
9889 | goto raise; | 9889 | goto raise; |
9890 | break; | 9890 | break; |
9891 | |||
9892 | } /* switch */ | 9891 | } /* switch */ |
9893 | 9892 | ||
9894 | out: | 9893 | out: |
@@ -10917,7 +10916,6 @@ struct heredoc { | |||
10917 | }; | 10916 | }; |
10918 | 10917 | ||
10919 | static smallint tokpushback; /* last token pushed back */ | 10918 | static smallint tokpushback; /* last token pushed back */ |
10920 | static smallint parsebackquote; /* nonzero if we are inside backquotes */ | ||
10921 | static smallint quoteflag; /* set if (part of) last token was quoted */ | 10919 | static smallint quoteflag; /* set if (part of) last token was quoted */ |
10922 | static token_id_t lasttoken; /* last token read (integer id Txxx) */ | 10920 | static token_id_t lasttoken; /* last token read (integer id Txxx) */ |
10923 | static struct heredoc *heredoclist; /* list of here documents to read */ | 10921 | static struct heredoc *heredoclist; /* list of here documents to read */ |
@@ -11577,19 +11575,6 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs) | |||
11577 | 11575 | ||
11578 | IF_ASH_BASH_COMPAT(smallint bash_dollar_squote = 0;) | 11576 | IF_ASH_BASH_COMPAT(smallint bash_dollar_squote = 0;) |
11579 | 11577 | ||
11580 | #if __GNUC__ | ||
11581 | /* Avoid longjmp clobbering */ | ||
11582 | (void) &out; | ||
11583 | (void) "ef; | ||
11584 | (void) &dblquote; | ||
11585 | (void) &varnest; | ||
11586 | (void) &arinest; | ||
11587 | (void) &parenlevel; | ||
11588 | (void) &dqvarnest; | ||
11589 | (void) &oldstyle; | ||
11590 | (void) &prevsyntax; | ||
11591 | (void) &syntax; | ||
11592 | #endif | ||
11593 | startlinno = g_parsefile->linno; | 11578 | startlinno = g_parsefile->linno; |
11594 | bqlist = NULL; | 11579 | bqlist = NULL; |
11595 | quotef = 0; | 11580 | quotef = 0; |
@@ -11757,7 +11742,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs) | |||
11757 | if (syntax == ARISYNTAX) | 11742 | if (syntax == ARISYNTAX) |
11758 | raise_error_syntax("missing '))'"); | 11743 | raise_error_syntax("missing '))'"); |
11759 | #endif | 11744 | #endif |
11760 | if (syntax != BASESYNTAX && !parsebackquote && eofmark == NULL) | 11745 | if (syntax != BASESYNTAX && eofmark == NULL) |
11761 | raise_error_syntax("unterminated quoted string"); | 11746 | raise_error_syntax("unterminated quoted string"); |
11762 | if (varnest != 0) { | 11747 | if (varnest != 0) { |
11763 | startlinno = g_parsefile->linno; | 11748 | startlinno = g_parsefile->linno; |
@@ -12053,34 +12038,17 @@ parsesub: { | |||
12053 | */ | 12038 | */ |
12054 | parsebackq: { | 12039 | parsebackq: { |
12055 | struct nodelist **nlpp; | 12040 | struct nodelist **nlpp; |
12056 | smallint savepbq; | ||
12057 | union node *n; | 12041 | union node *n; |
12058 | char *volatile str; | 12042 | char *str; |
12059 | struct jmploc jmploc; | ||
12060 | struct jmploc *volatile savehandler; | ||
12061 | size_t savelen; | 12043 | size_t savelen; |
12062 | smallint saveprompt = 0; | 12044 | smallint saveprompt = 0; |
12063 | 12045 | ||
12064 | #ifdef __GNUC__ | ||
12065 | (void) &saveprompt; | ||
12066 | #endif | ||
12067 | savepbq = parsebackquote; | ||
12068 | if (setjmp(jmploc.loc)) { | ||
12069 | free(str); | ||
12070 | parsebackquote = 0; | ||
12071 | exception_handler = savehandler; | ||
12072 | longjmp(exception_handler->loc, 1); | ||
12073 | } | ||
12074 | INT_OFF; | ||
12075 | str = NULL; | 12046 | str = NULL; |
12076 | savelen = out - (char *)stackblock(); | 12047 | savelen = out - (char *)stackblock(); |
12077 | if (savelen > 0) { | 12048 | if (savelen > 0) { |
12078 | str = ckmalloc(savelen); | 12049 | str = alloca(savelen); |
12079 | memcpy(str, stackblock(), savelen); | 12050 | memcpy(str, stackblock(), savelen); |
12080 | } | 12051 | } |
12081 | savehandler = exception_handler; | ||
12082 | exception_handler = &jmploc; | ||
12083 | INT_ON; | ||
12084 | if (oldstyle) { | 12052 | if (oldstyle) { |
12085 | /* We must read until the closing backquote, giving special | 12053 | /* We must read until the closing backquote, giving special |
12086 | * treatment to some slashes, and then push the string and | 12054 | * treatment to some slashes, and then push the string and |
@@ -12151,7 +12119,6 @@ parsebackq: { | |||
12151 | nlpp = &(*nlpp)->next; | 12119 | nlpp = &(*nlpp)->next; |
12152 | *nlpp = stzalloc(sizeof(**nlpp)); | 12120 | *nlpp = stzalloc(sizeof(**nlpp)); |
12153 | /* (*nlpp)->next = NULL; - stzalloc did it */ | 12121 | /* (*nlpp)->next = NULL; - stzalloc did it */ |
12154 | parsebackquote = oldstyle; | ||
12155 | 12122 | ||
12156 | if (oldstyle) { | 12123 | if (oldstyle) { |
12157 | saveprompt = doprompt; | 12124 | saveprompt = doprompt; |
@@ -12180,13 +12147,7 @@ parsebackq: { | |||
12180 | if (str) { | 12147 | if (str) { |
12181 | memcpy(out, str, savelen); | 12148 | memcpy(out, str, savelen); |
12182 | STADJUST(savelen, out); | 12149 | STADJUST(savelen, out); |
12183 | INT_OFF; | ||
12184 | free(str); | ||
12185 | str = NULL; | ||
12186 | INT_ON; | ||
12187 | } | 12150 | } |
12188 | parsebackquote = savepbq; | ||
12189 | exception_handler = savehandler; | ||
12190 | USTPUTC(CTLBACKQ, out); | 12151 | USTPUTC(CTLBACKQ, out); |
12191 | if (oldstyle) | 12152 | if (oldstyle) |
12192 | goto parsebackq_oldreturn; | 12153 | goto parsebackq_oldreturn; |
@@ -12206,7 +12167,6 @@ parsearith: { | |||
12206 | goto parsearith_return; | 12167 | goto parsearith_return; |
12207 | } | 12168 | } |
12208 | #endif | 12169 | #endif |
12209 | |||
12210 | } /* end of readtoken */ | 12170 | } /* end of readtoken */ |
12211 | 12171 | ||
12212 | /* | 12172 | /* |
diff --git a/shell/ash_test/ash-misc/echo_write_error.tests b/shell/ash_test/ash-misc/echo_write_error.tests index 0a40c9ff7..0a40c9ff7 100644..100755 --- a/shell/ash_test/ash-misc/echo_write_error.tests +++ b/shell/ash_test/ash-misc/echo_write_error.tests | |||
diff --git a/shell/ash_test/ash-misc/tickquote1.right b/shell/ash_test/ash-misc/tickquote1.right new file mode 100644 index 000000000..2e661bfe3 --- /dev/null +++ b/shell/ash_test/ash-misc/tickquote1.right | |||
@@ -0,0 +1 @@ | |||
./tickquote1.tests: line 1: syntax error: unterminated quoted string | |||
diff --git a/shell/ash_test/ash-misc/tickquote1.tests b/shell/ash_test/ash-misc/tickquote1.tests new file mode 100755 index 000000000..90d5bbc9b --- /dev/null +++ b/shell/ash_test/ash-misc/tickquote1.tests | |||
@@ -0,0 +1 @@ | |||
echo `"pwd` | |||
diff --git a/shell/hush.c b/shell/hush.c index f2c0a70f2..3ca04494c 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -442,7 +442,7 @@ enum { | |||
442 | MAYBE_ASSIGNMENT = 0, | 442 | MAYBE_ASSIGNMENT = 0, |
443 | DEFINITELY_ASSIGNMENT = 1, | 443 | DEFINITELY_ASSIGNMENT = 1, |
444 | NOT_ASSIGNMENT = 2, | 444 | NOT_ASSIGNMENT = 2, |
445 | /* Not an assigment, but next word may be: "if v=xyz cmd;" */ | 445 | /* Not an assignment, but next word may be: "if v=xyz cmd;" */ |
446 | WORD_IS_KEYWORD = 3, | 446 | WORD_IS_KEYWORD = 3, |
447 | }; | 447 | }; |
448 | /* Used for initialization: o_string foo = NULL_O_STRING; */ | 448 | /* Used for initialization: o_string foo = NULL_O_STRING; */ |
@@ -5390,7 +5390,6 @@ static NOINLINE int expand_vars_to_list(o_string *output, int n, char *arg) | |||
5390 | !!(output->o_expflags & EXP_FLAG_ESC_GLOB_CHARS)); | 5390 | !!(output->o_expflags & EXP_FLAG_ESC_GLOB_CHARS)); |
5391 | } | 5391 | } |
5392 | break; | 5392 | break; |
5393 | |||
5394 | } /* switch (char after <SPECIAL_VAR_SYMBOL>) */ | 5393 | } /* switch (char after <SPECIAL_VAR_SYMBOL>) */ |
5395 | 5394 | ||
5396 | if (val && val[0]) { | 5395 | if (val && val[0]) { |
diff --git a/shell/shell_common.c b/shell/shell_common.c index 2244a3c97..1567d1de4 100644 --- a/shell/shell_common.c +++ b/shell/shell_common.c | |||
@@ -500,7 +500,6 @@ shell_builtin_ulimit(char **argv) | |||
500 | /* bad option. getopt already complained. */ | 500 | /* bad option. getopt already complained. */ |
501 | break; | 501 | break; |
502 | } | 502 | } |
503 | |||
504 | } /* while (there are options) */ | 503 | } /* while (there are options) */ |
505 | 504 | ||
506 | return 0; | 505 | return 0; |
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 266657f3b..156f487e5 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -237,7 +237,6 @@ enum { | |||
237 | OPT_dup = IF_FEATURE_SYSLOGD_DUP( (1 << OPTBIT_dup )) + 0, | 237 | OPT_dup = IF_FEATURE_SYSLOGD_DUP( (1 << OPTBIT_dup )) + 0, |
238 | OPT_cfg = IF_FEATURE_SYSLOGD_CFG( (1 << OPTBIT_cfg )) + 0, | 238 | OPT_cfg = IF_FEATURE_SYSLOGD_CFG( (1 << OPTBIT_cfg )) + 0, |
239 | OPT_kmsg = IF_FEATURE_KMSG_SYSLOG( (1 << OPTBIT_kmsg )) + 0, | 239 | OPT_kmsg = IF_FEATURE_KMSG_SYSLOG( (1 << OPTBIT_kmsg )) + 0, |
240 | |||
241 | }; | 240 | }; |
242 | #define OPTION_STR "m:nO:l:S" \ | 241 | #define OPTION_STR "m:nO:l:S" \ |
243 | IF_FEATURE_ROTATE_LOGFILE("s:" ) \ | 242 | IF_FEATURE_ROTATE_LOGFILE("s:" ) \ |
diff --git a/util-linux/mkfs_reiser.c b/util-linux/mkfs_reiser.c index 13abaa889..56c8f0ab5 100644 --- a/util-linux/mkfs_reiser.c +++ b/util-linux/mkfs_reiser.c | |||
@@ -66,7 +66,7 @@ struct reiserfs_super_block { | |||
66 | 66 | ||
67 | char s_magic[10]; /* 52 "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */ | 67 | char s_magic[10]; /* 52 "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */ |
68 | uint16_t sb_fs_state; /* 62 it is set to used by fsck to mark which phase of rebuilding is done (used for fsck debugging) */ | 68 | uint16_t sb_fs_state; /* 62 it is set to used by fsck to mark which phase of rebuilding is done (used for fsck debugging) */ |
69 | uint32_t sb_hash_function_code; /* 64 code of fuction which was/is/will be used to sort names in a directory. See codes in above */ | 69 | uint32_t sb_hash_function_code; /* 64 code of function which was/is/will be used to sort names in a directory. See codes in above */ |
70 | uint16_t sb_tree_height; /* 68 height of filesytem tree. Tree consisting of only one root block has 2 here */ | 70 | uint16_t sb_tree_height; /* 68 height of filesytem tree. Tree consisting of only one root block has 2 here */ |
71 | uint16_t sb_bmap_nr; /* 70 amount of bitmap blocks needed to address each block of file system */ | 71 | uint16_t sb_bmap_nr; /* 70 amount of bitmap blocks needed to address each block of file system */ |
72 | uint16_t sb_version; /* 72 this field is only reliable on filesystem with non-standard journal */ | 72 | uint16_t sb_version; /* 72 this field is only reliable on filesystem with non-standard journal */ |