aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-07-04modinfo: fix module parsing with kernel >= 2.6.37David Marchand
display() function returns the length of the value we are displaying + 1. As a consequence, if we have field=value\0field=value\0field=value in the binary, then the second occurence will be skipped as ptr will miss the first character of the following field. Example trying to list aliases from ixgbe.ko on a 3.2 kernel. - In the module we have: alias=pci:v00008086d00001560sv*sd*bc*sc*i*\0 alias=pci:v00008086d0000154Asv*sd*bc*sc*i*\0 alias=pci:v00008086d00001557sv*sd*bc*sc*i*\0 alias=pci:v00008086d0000154Fsv*sd*bc*sc*i*\0 alias=pci:v00008086d0000154Dsv*sd*bc*sc*i*\0 ... - Using modinfo -F alias ixgbe returns: alias: pci:v00008086d00001560sv*sd*bc*sc*i* alias: pci:v00008086d00001557sv*sd*bc*sc*i* alias: pci:v00008086d0000154Dsv*sd*bc*sc*i* ... This problem appeared with kernel commit "modules: no need to align .modinfo strings" b6472776816af1ed52848c93d26e3edb3b17adab in 2.6.37. Fix this by not trusting display() return value but increment ptr by strlen(ptr) (the same way as depmod.c does). Signed-off-by: David Marchand <david.marchand@6wind.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-04fatattr: use the standard type for 32-bit intDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-04setlogcons: fix help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-03syslogd: make "reopen log file every second" logic work for multiple logsJoshua Judson Rosen
Move last_log_time from a single global to *each logFile_t* so that we can actually apply the logic to every log-file in multi-file configurations, rather than working only for the first file written in each 1-second interval and then leaving the others connected to possibly wrong files. Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-02syslogd: syslogd: don't *decrement* log_file->size on write failuresJoshua Judson Rosen
Even if we fail to write to a log-file, and it's not growing, it's not *shrinking* either.... Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-02syslogd: make "-O -" log to stdoutDenys Vlasenko
function old new delta packed_usage 29871 29908 +37 log_locally 404 440 +36 syslogd_main 1966 1956 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 73/-10) Total: 63 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-01test: fix mishandling of "test '(' = '('" and similarDenys Vlasenko
function old new delta test_main 246 350 +104 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-01libbb: fix bb_ask() to flush input before prompt, not after. Closes 7190Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-30cpio: reinstate "options:" line in help textDenys Vlasenko
Otherwise, help text is confusing: where do operation modes end and where options start? Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-30Rename INIT_LAST to INIT_FUNC to avoid confusionBartosz Golaszewski
We don't have an INIT_FIRST, so let's rename INIT_LAST to INIT_FUNC to imply that the function is called at program start-up. Also: the priority argument for __attribute__((constructor)) isn't used, so let's remove it. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-30fatattr: new appletPascal Bellard
function old new delta fatattr_main - 281 +281 packed_usage 29821 29871 +50 bit_to_char - 10 +10 applet_names 2472 2480 +8 applet_main 1436 1440 +4 applet_nameofs 718 720 +2 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 4/0 up/down: 355/0) Total: 355 bytes Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-30lzop: add overflow checkDenys Vlasenko
See CVE-2014-4607 http://www.openwall.com/lists/oss-security/2014/06/26/20 function old new delta lzo1x_decompress_safe 1010 1031 +21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-27stat: fix printing selinux context and null-dereferenceMichael Gernoth
busybox stat tries to always print the selinux context, even if it is not requested which leads to a segmentation fault due to dereferencing a null-pointer. This also changes the format-string used to print the context to so it actually produces useful output. Signed-off-by: Michael Gernoth <michael@gernoth.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-27ftpd: do not use root_fd if we are not in chrootDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-27ftpd: for LIST, open current directory *in the child*Denys Vlasenko
Last change introduced an open fd leak. This is the fix. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-27ftpd: escape chroot prior to re-executing ls helperDenys Vlasenko
When we merely chdir to saved "real" root fd, exec("proc/self/exe") works for static executables but not for dynamic ones (they can't find their interpreter). With this patch, we also *chroot* to real root. As a bonus, this gives us proper usernames, timezone conversion etc. function old new delta popen_ls 203 259 +56 ftpd_main 2362 2366 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-26awk: fix handling of "if ... break ; else ..." - closes 7226Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-26ftpd: optimize writes of LIST results a bitDenys Vlasenko
function old new delta handle_dir_common 201 207 +6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25nanddump: change default to --bb=skipbadRichard Genoud
since mtd-utils 1.4.7, the default behaviour of nanddump is skipbad (commit 2521d4f1b6b9866a9c89f3c11a4f6a3d763ff1d7) Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25nanddump: kill -b Omit bad blockRichard Genoud
since mtd-utils 1.4.7, the omit bad block method has been removed. (cf commit d8b8f780ec3c916f3990e9227d6bfbb22bf42ef8) Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25nanddump: add options --bb=skipbad and padbadRichard Genoud
In mtd-utils, the bad block options changed in favor of --bb=[skipbad|padbad|dumpbad] and omitbad has been removed. This patch add the --bb=skipbad and padbad methods to busybox' nanddump. padbad is the current default behaviour. The difference between skipbad and omitbad is this one: On a 16K block NAND, if the 1st block of mtd0 is bad, we'll have: nanddump -b -l 16384 /dev/mtd0 | wc -c 0 nanddump --bb=skipbad -l 16384 /dev/mtd0 | wc -c 16384 <- data from 1st good block Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25nanddump: correct rounding to next page (lead to infinite loop)Richard Genoud
The rounding to next page formula was wrong: ex: (len | ~(meminfo->writesize - 1)) + 1; len=128K writesize=4K (len | ~(meminfo->writesize - 1)) + 1 => 4 294 963 201 ?! correct rounding formula: ((len - 1) | (meminfo->writesize - 1)) + 1 => 128K len = 130K ((len - 1) | (meminfo->writesize - 1)) + 1 => 132K modprobe nandsim parts="20,20" badblocks="22,23" without patch: nanddump /dev/mtd1 | wc -c [...] infinite loop with the patch: nanddump /dev/mtd1 | wc -c 327680 Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25ftpd: support deprecated XPWD commandDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25libbb: fix compile failure if both ARG_MAX and _SC_ARG_MAX are definedDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22unlink: new appletIsaac Dunham
function old new delta unlink_main - 45 +45 packed_usage 29667 29686 +19 Signed-off-by: Isaac Dunham <ibid.ag@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22unit-tests: implement the unit-testing frameworkBartosz Golaszewski
This set of patches adds a simple unit-testing framework to Busybox unit-tests: add some helper macros for unit-test framework implementation unit-tests: implement the unit-testing framework unit-tests: add basic documentation on writing the unit test cases unit-tests: modify the Makefile 'test' target to run unit-tests too unit-tests: add two example test cases unit-tests: modify the existing strrstr test code to use the unit-test framework Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22libbb: use a wrapper around sysconf(_SC_CLK_TCK) to save a few bytesBartosz Golaszewski
function old new delta bb_sc_clk_tck - 10 +10 timescmd 118 113 -5 print_route 1763 1758 -5 mpstat_main 1288 1283 -5 iostat_main 1947 1942 -5 INET_setroute 879 871 -8 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/5 up/down: 10/-28) Total: -18 bytes Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22find: use sysconf(_SC_ARG_MAX) to determine the command-line size limitDenys Vlasenko
The find utility uses a hardcoded value of 32 * 1024 as the limit of the command-line length when calling 'find -exec ... {} +'. This results in over 4 times more execve() calls than in coreutils' find. This patch uses the limit defined in system headers. Based on the patch by Bartosz Golaszewski <bartekgola@gmail.com>. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-19find: exit code fixes for find -execDenys Vlasenko
function old new delta func_exec 127 100 -27 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-17find: add optional support for '-exec ... {} +'Bartosz Golaszewski
function old new delta do_exec - 309 +309 parse_params 1416 1487 +71 find_main 342 406 +64 packed_usage 29958 30014 +56 func_exec 138 127 -11 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/1 up/down: 500/-11) Total: 489 bytes Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-16udhcpc: make hostname sanitization optional. Closes 3979Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-02syslogd: Unify unlink/truncate + unlock log-rotation logicJoshua Judson Rosen
Always unlink + reopen, rather than sometimes using ftruncate(); using a single code-path reduces the opportunity for either mistakes or duplicate code. Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-02syslogd: remember to un-writelock log-files even when called with "-b 0"Joshua Judson Rosen
Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-02syslogd: avoid spurious ftrunctate() calls for "-b 0"Joshua Judson Rosen
Forgetting to re-set log_file->size after truncating to zero discards log-data for the next 1 second following an oversize-induced purge, when we shouldn't necessarily throw that data away. Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-26modprobe-small: fix safe_strncpy truncating last char of module nameDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-19Add conditional support for -v / --verboseDenys Vlasenko
With FEATURE_VERBOSE off, practically no size change. With it on: function old new delta remove_file 493 556 +63 install_main 719 765 +46 bb_make_directory 383 419 +36 rmdir_main 162 191 +29 copy_file 1516 1544 +28 mv_main 502 525 +23 cmp_main 677 693 +16 bbconfig_config_bz2 5264 5279 +15 mkdir_main 158 168 +10 install_longopts 66 76 +10 rm_main 167 175 +8 nexpr 840 846 +6 scan_tree 275 280 +5 fsck_main 1807 1811 +4 ed_main 2541 2545 +4 expand_one_var 1574 1575 +1 swap_on_off_main 420 418 -2 parse_command 1443 1440 -3 redirect 1279 1274 -5 do_load 946 918 -28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 16/4 up/down: 304/-38) Total: 266 bytes Based on the patch by Igor Živković. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-11getty: explain when setsid() fails. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-11Merge branch 'master' of git+ssh://vda@busybox.net/var/lib/git/busyboxDenys Vlasenko
2014-05-04trylink: emit names of linked executablesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-04which: rewriteTito Ragusa
function old new delta which_main 237 212 -25 Signed-off-by: Tito Ragusa <farmatito@tiscali.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-03trylink: emit names of linked executablesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-03which: rewriteTimo Teräs
function old new delta which_main 237 212 -25 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02libbb: rename execable -> executable. No code changesDenys Vlasenko
English speakers complained that it sounded awfully broken. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02libbb: fix empty PATH components handlingDenys Vlasenko
function old new delta find_execable 81 86 +5 exists_execable 71 66 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02rtcwake: fix incorrect (reversed) rtc/sys adjuestment; code shrinkDenys Vlasenko
function old new delta rtcwake_main 482 462 -20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02libbb: fix thinko in rtc_xopen()Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02libbb: make rtc_xopen try harder on EBUSYDenys Vlasenko
function old new delta rtc_xopen 77 139 +62 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02Fix compile failuresDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30crond: implement "SHELL=prog" in crontab. Export LOGNAME as POSIX wantsDenys Vlasenko
function old new delta fork_job 343 456 +113 load_crontab 688 777 +89 crond_main 1456 1434 -22 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 202/-22) Total: 180 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30crond: simplify logging codeDenys Vlasenko
Slight change in behavior: now -l 5 will enable the same messages formerly only enabled for -d 5. (Old behavior was non-sensical). function old new delta reopen_logfile_to_stderr - 34 +34 log8 - 26 +26 log7 - 26 +26 log5 - 26 +26 load_crontab 706 688 -18 rescan_crontab_dir 157 137 -20 crond_main 1486 1456 -30 fork_job 389 343 -46 crondlog 108 38 -70 ------------------------------------------------------------------------------ (add/remove: 4/0 grow/shrink: 0/5 up/down: 112/-184) Total: -72 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>