diff options
53 files changed, 63 insertions, 19 deletions
diff --git a/archival/cpio.c b/archival/cpio.c index a3036e1..3b15507 100644 --- a/archival/cpio.c +++ b/archival/cpio.c @@ -174,6 +174,7 @@ struct globals { #define G (*(struct globals*)bb_common_bufsiz1) void BUG_cpio_globals_too_big(void); #define INIT_G() do { \ + setup_common_bufsiz(); \ G.owner_ugid.uid = -1L; \ G.owner_ugid.gid = -1L; \ } while (0) diff --git a/archival/lzop.c b/archival/lzop.c index 1371c97..4afa218 100644 --- a/archival/lzop.c +++ b/archival/lzop.c @@ -445,7 +445,7 @@ struct globals { chksum_t chksum_out; } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) //#define G (*ptr_to_globals) //#define INIT_G() do { // SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); diff --git a/archival/rpm.c b/archival/rpm.c index 079b7a9..83160f9 100644 --- a/archival/rpm.c +++ b/archival/rpm.c @@ -95,7 +95,7 @@ struct globals { int tagcount; } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) static void extract_cpio(int fd, const char *source_rpm) { diff --git a/console-tools/resize.c b/console-tools/resize.c index ed80aa0..a3342a1 100644 --- a/console-tools/resize.c +++ b/console-tools/resize.c @@ -19,6 +19,7 @@ #define ESC "\033" #define old_termios_p ((struct termios*)bb_common_bufsiz1) +#define INIT_G() do { setup_common_bufsiz(); } while (0) static void onintr(int sig UNUSED_PARAM) @@ -34,6 +35,8 @@ int resize_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) struct winsize w = { 0, 0, 0, 0 }; int ret; + INIT_G(); + /* We use _stderr_ in order to make resize usable * in shell backticks (those redirect stdout away from tty). * NB: other versions of resize open "/dev/tty" diff --git a/coreutils/dd.c b/coreutils/dd.c index a5b8882..4dc3029 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c @@ -111,6 +111,7 @@ struct globals { } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ /* we have to zero it out because of NOEXEC */ \ memset(&G, 0, sizeof(G)); \ } while (0) diff --git a/coreutils/du.c b/coreutils/du.c index 3d67776..1240bcb 100644 --- a/coreutils/du.c +++ b/coreutils/du.c @@ -87,7 +87,7 @@ struct globals { dev_t dir_dev; } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) static void print(unsigned long long size, const char *filename) diff --git a/coreutils/expr.c b/coreutils/expr.c index 59a66d9..ce6b2d1 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c @@ -101,7 +101,7 @@ struct globals { char **args; } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) /* forward declarations */ static VALUE *eval(void); diff --git a/coreutils/ls.c b/coreutils/ls.c index e8c3e04..344b4e6 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -368,6 +368,7 @@ struct globals { } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ /* we have to zero it out because of NOEXEC */ \ memset(&G, 0, sizeof(G)); \ IF_FEATURE_AUTOWIDTH(G_terminal_width = TERMINAL_WIDTH;) \ diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index 1e252ca..c8a6541 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c @@ -217,6 +217,7 @@ enum { G_pseudo_offset = 0 }; #endif #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ G.bytes_per_block = 32; \ } while (0) diff --git a/coreutils/tail.c b/coreutils/tail.c index cdc9fb6..39f8767 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c @@ -56,7 +56,7 @@ struct globals { bool exitcode; } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) static void tail_xprint_header(const char *fmt, const char *filename) { diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c index a5e5357..c671b92 100644 --- a/debianutils/run_parts.c +++ b/debianutils/run_parts.c @@ -100,7 +100,7 @@ struct globals { #define names (G.names) #define cur (G.cur ) #define cmd (G.cmd ) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) enum { NUM_CMD = (COMMON_BUFSIZE - sizeof(G)) / sizeof(cmd[0]) - 1 }; diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index 6b8d53b..3625ffe 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c @@ -200,6 +200,7 @@ struct globals { #define user_id (G.user_id ) #define signal_nr (G.signal_nr ) #define INIT_G() do { \ + setup_common_bufsiz(); \ user_id = -1; \ signal_nr = 15; \ } while (0) diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index b534568..59514a1 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c @@ -172,6 +172,7 @@ struct globals { } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ } while (0) diff --git a/editors/sed.c b/editors/sed.c index 330190e..ed48de1 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -164,6 +164,7 @@ struct globals { } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ G.sed_cmd_tail = &G.sed_cmd_head; \ } while (0) diff --git a/findutils/find.c b/findutils/find.c index 32d8303..d71c697 100644 --- a/findutils/find.c +++ b/findutils/find.c @@ -424,6 +424,7 @@ struct globals { } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ /* we have to zero it out because of NOEXEC */ \ memset(&G, 0, sizeof(G)); \ diff --git a/findutils/grep.c b/findutils/grep.c index a669ac8..b072cd4 100644 --- a/findutils/grep.c +++ b/findutils/grep.c @@ -204,6 +204,7 @@ struct globals { } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ } while (0) #define max_matches (G.max_matches ) diff --git a/findutils/xargs.c b/findutils/xargs.c index bfbd949..ae01a49 100644 --- a/findutils/xargs.c +++ b/findutils/xargs.c @@ -103,6 +103,7 @@ struct globals { } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ G.eof_str = NULL; /* need to clear by hand because we are NOEXEC applet */ \ IF_FEATURE_XARGS_SUPPORT_REPL_STR(G.repl_str = "{}";) \ IF_FEATURE_XARGS_SUPPORT_REPL_STR(G.eol_ch = '\n';) \ diff --git a/init/bootchartd.c b/init/bootchartd.c index 5101b28..7f511e6 100644 --- a/init/bootchartd.c +++ b/init/bootchartd.c @@ -117,7 +117,7 @@ struct globals { char jiffy_line[COMMON_BUFSIZE]; } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) static void dump_file(FILE *fp, const char *filename) { diff --git a/loginutils/login.c b/loginutils/login.c index ea7c5a2..94b6c45 100644 --- a/loginutils/login.c +++ b/loginutils/login.c @@ -140,7 +140,7 @@ struct globals { struct termios tty_attrs; } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) #if ENABLE_FEATURE_NOLOGIN diff --git a/miscutils/crond.c b/miscutils/crond.c index 8536d43..f96c96e 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c @@ -143,6 +143,7 @@ struct globals { } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ G.log_level = 8; \ G.crontab_dir_name = CRONTABS; \ } while (0) diff --git a/miscutils/dc.c b/miscutils/dc.c index 3fbb89f..4d92bc3 100644 --- a/miscutils/dc.c +++ b/miscutils/dc.c @@ -53,6 +53,7 @@ enum { STACK_SIZE = (COMMON_BUFSIZE - offsetof(struct globals, stack)) / sizeof( #define base (G.base ) #define stack (G.stack ) #define INIT_G() do { \ + setup_common_bufsiz(); \ base = 10; \ } while (0) diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 9e141de..b4c5876 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c @@ -432,6 +432,7 @@ struct globals { #define hwif_ctrl (G.hwif_ctrl ) #define hwif_irq (G.hwif_irq ) #define INIT_G() do { \ + setup_common_bufsiz(); \ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ } while (0) diff --git a/networking/arp.c b/networking/arp.c index 5f78186..9381eb5 100644 --- a/networking/arp.c +++ b/networking/arp.c @@ -76,6 +76,7 @@ struct globals { #define device (G.device ) #define hw_set (G.hw_set ) #define INIT_G() do { \ + setup_common_bufsiz(); \ device = ""; \ } while (0) diff --git a/networking/arping.c b/networking/arping.c index 52f5ba5..6b0de4d 100644 --- a/networking/arping.c +++ b/networking/arping.c @@ -77,6 +77,7 @@ struct globals { #define brd_recv (G.brd_recv ) #define req_recv (G.req_recv ) #define INIT_G() do { \ + setup_common_bufsiz(); \ count = -1; \ } while (0) diff --git a/networking/ftpd.c b/networking/ftpd.c index 8553a28..360d1e6 100644 --- a/networking/ftpd.c +++ b/networking/ftpd.c @@ -126,6 +126,7 @@ struct globals { } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ /* Moved to main */ \ /*strcpy(G.msg_ok + 4, MSG_OK );*/ \ /*strcpy(G.msg_err + 4, MSG_ERR);*/ \ diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 61bc45c..91fb456 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c @@ -71,6 +71,7 @@ enum { BUFSZ = COMMON_BUFSIZE - offsetof(struct globals, buf) }; #define do_continue (G.do_continue ) #define buf (G.buf ) #define INIT_G() do { \ + setup_common_bufsiz(); \ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ } while (0) diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 399ff6b..25b04c9 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c @@ -131,7 +131,7 @@ struct globals { char *shell; } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) static const char keywords_up_down[] ALIGN1 = diff --git a/networking/inetd.c b/networking/inetd.c index aa35ffa..8d44b51 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -350,6 +350,7 @@ enum { LINE_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line) }; #define allsock (G.allsock ) #define line (G.line ) #define INIT_G() do { \ + setup_common_bufsiz(); \ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ rlim_ofile_cur = OPEN_MAX; \ global_queuelen = 128; \ diff --git a/networking/ping.c b/networking/ping.c index 7616609..cfe6826 100644 --- a/networking/ping.c +++ b/networking/ping.c @@ -188,7 +188,7 @@ struct globals { char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) static void noresp(int ign UNUSED_PARAM) { @@ -398,6 +398,7 @@ struct globals { #define pingaddr (G.pingaddr ) #define rcvd_tbl (G.rcvd_tbl ) #define INIT_G() do { \ + setup_common_bufsiz(); \ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ datalen = DEFDATALEN; \ timeout = MAXWAIT; \ diff --git a/networking/slattach.c b/networking/slattach.c index d9d8fe7..2d1305e 100644 --- a/networking/slattach.c +++ b/networking/slattach.c @@ -39,7 +39,7 @@ struct globals { #define handle (G.handle ) #define saved_disc (G.saved_disc ) #define saved_state (G.saved_state ) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) /* diff --git a/networking/tc.c b/networking/tc.c index 1372ca0..d0bcbde 100644 --- a/networking/tc.c +++ b/networking/tc.c @@ -71,6 +71,7 @@ struct globals { #define filter_prio (G.filter_prio) #define filter_proto (G.filter_proto) #define INIT_G() do { \ + setup_common_bufsiz(); \ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ } while (0) diff --git a/networking/tcpudp.c b/networking/tcpudp.c index 6249730..31bc704 100644 --- a/networking/tcpudp.c +++ b/networking/tcpudp.c @@ -101,6 +101,7 @@ struct globals { #define env_cur (G.env_cur ) #define env_var (G.env_var ) #define INIT_G() do { \ + setup_common_bufsiz(); \ cmax = 30; \ env_cur = &env_var[0]; \ } while (0) diff --git a/networking/telnet.c b/networking/telnet.c index 2946bc8..d2daf5c 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -111,6 +111,7 @@ struct globals { } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ } while (0) diff --git a/networking/telnetd.c b/networking/telnetd.c index 13d5a8f..13c36aa 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c @@ -85,6 +85,7 @@ struct globals { } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ G.loginpath = "/bin/login"; \ G.issuefile = "/etc/issue.net"; \ } while (0) diff --git a/networking/tftp.c b/networking/tftp.c index 8aeb79a..e879c46 100644 --- a/networking/tftp.c +++ b/networking/tftp.c @@ -131,6 +131,7 @@ struct globals { } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ } while (0) diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c index 1722a85..f52a0cf 100644 --- a/networking/udhcp/dhcprelay.c +++ b/networking/udhcp/dhcprelay.c @@ -34,6 +34,7 @@ struct xid_item { } FIX_ALIASING; #define dhcprelay_xid_list (*(struct xid_item*)bb_common_bufsiz1) +#define INIT_G() do { setup_common_bufsiz(); } while (0) static struct xid_item *xid_add(uint32_t xid, struct sockaddr_in *ip, int client) { @@ -257,6 +258,8 @@ int dhcprelay_main(int argc, char **argv) int num_sockets, max_socket; uint32_t our_nip; + INIT_G(); + server_addr.sin_family = AF_INET; server_addr.sin_addr.s_addr = htonl(INADDR_BROADCAST); server_addr.sin_port = htons(SERVER_PORT); diff --git a/networking/zcip.c b/networking/zcip.c index 7964345..47f3216 100644 --- a/networking/zcip.c +++ b/networking/zcip.c @@ -92,7 +92,7 @@ struct globals { uint32_t localnet_ip; } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) /** diff --git a/procps/free.c b/procps/free.c index 9fde64b..fca9a22 100644 --- a/procps/free.c +++ b/procps/free.c @@ -37,7 +37,7 @@ struct globals { #endif } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) static unsigned long long scale(unsigned long d) diff --git a/procps/fuser.c b/procps/fuser.c index 2cda0f9..6dac852 100644 --- a/procps/fuser.c +++ b/procps/fuser.c @@ -46,6 +46,7 @@ struct globals { } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ G.mypid = getpid(); \ G.killsig = SIGKILL; \ } while (0) diff --git a/procps/ps.c b/procps/ps.c index 65d62e2..08dfce1 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -153,7 +153,7 @@ struct globals { #define buffer (G.buffer ) #define terminal_width (G.terminal_width ) #define kernel_HZ (G.kernel_HZ ) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) #if ENABLE_FEATURE_PS_TIME /* for ELF executables, notes are pushed before environment and args */ diff --git a/procps/top.c b/procps/top.c index 1c42b24..640bcdc 100644 --- a/procps/top.c +++ b/procps/top.c @@ -202,6 +202,7 @@ enum { LINE_BUF_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line_buf) }; #define total_pcpu (G.total_pcpu ) #define line_buf (G.line_buf ) #define INIT_G() do { \ + setup_common_bufsiz(); \ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ BUILD_BUG_ON(LINE_BUF_SIZE <= 80); \ } while (0) diff --git a/runit/runsv.c b/runit/runsv.c index 8833f4c..e0e3150 100644 --- a/runit/runsv.c +++ b/runit/runsv.c @@ -115,6 +115,7 @@ struct globals { #define dir (G.dir ) #define svd (G.svd ) #define INIT_G() do { \ + setup_common_bufsiz(); \ pidchanged = 1; \ } while (0) diff --git a/runit/runsvdir.c b/runit/runsvdir.c index 49c8f5b..2b79275 100644 --- a/runit/runsvdir.c +++ b/runit/runsvdir.c @@ -93,7 +93,7 @@ struct globals { #define logpipe (G.logpipe ) #define pfd (G.pfd ) #define stamplog (G.stamplog ) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) static void fatal2_cannot(const char *m1, const char *m2) { @@ -207,7 +207,7 @@ struct globals { #define tstart (G.tstart ) #define tnow (G.tnow ) #define svstatus (G.svstatus ) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) #define str_equal(s,t) (!strcmp((s), (t))) diff --git a/scripts/generate_BUFSIZ.sh b/scripts/generate_BUFSIZ.sh index afe9eee..bb07386 100755 --- a/scripts/generate_BUFSIZ.sh +++ b/scripts/generate_BUFSIZ.sh @@ -111,4 +111,6 @@ fi if test $OLD != $REM; then echo "Space in _end[] is $REM bytes. Rerun make to use larger COMMON_BUFSIZE." +else + echo "COMMON_BUFSIZE = $REM bytes" fi diff --git a/selinux/setfiles.c b/selinux/setfiles.c index 441345a..51a7e63 100644 --- a/selinux/setfiles.c +++ b/selinux/setfiles.c @@ -80,6 +80,7 @@ struct globals { #define G (*(struct globals*)bb_common_bufsiz1) void BUG_setfiles_globals_too_big(void); #define INIT_G() do { \ + setup_common_bufsiz(); \ if (sizeof(G) > COMMON_BUFSIZE) \ BUG_setfiles_globals_too_big(); \ /* memset(&G, 0, sizeof(G)); - already is */ \ diff --git a/sysklogd/logread.c b/sysklogd/logread.c index ebd7f8b..5b99973 100644 --- a/sysklogd/logread.c +++ b/sysklogd/logread.c @@ -73,6 +73,7 @@ struct globals { #define SMrdn (G.SMrdn) #define shbuf (G.shbuf) #define INIT_G() do { \ + setup_common_bufsiz(); \ memcpy(SMrup, init_sem, sizeof(init_sem)); \ } while (0) diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 7473b18..37514eb 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c @@ -288,6 +288,7 @@ struct globals { } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ + setup_common_bufsiz(); \ IF_NOT_FEATURE_MDEV_CONF(G.cur_rule.maj = -1;) \ IF_NOT_FEATURE_MDEV_CONF(G.cur_rule.mode = 0660;) \ } while (0) diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index f945179..dcb53f0 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c @@ -76,6 +76,7 @@ struct swap_header_v1 { #define NWORDS 129 #define hdr ((struct swap_header_v1*)bb_common_bufsiz1) +#define INIT_G() do { setup_common_bufsiz(); } while (0) struct BUG_sizes { char swap_header_v1_wrong[sizeof(*hdr) != (NWORDS * 4) ? -1 : 1]; @@ -93,6 +94,8 @@ int mkswap_main(int argc UNUSED_PARAM, char **argv) off_t len; const char *label = ""; + INIT_G(); + opt_complementary = "-1"; /* at least one param */ /* TODO: -p PAGESZ, -U UUID */ getopt32(argv, "L:", &label); diff --git a/util-linux/more.c b/util-linux/more.c index 58be3ac..95cbdd9 100644 --- a/util-linux/more.c +++ b/util-linux/more.c @@ -33,10 +33,10 @@ struct globals { struct termios new_settings; } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) -#define INIT_G() ((void)0) #define initial_settings (G.initial_settings) #define new_settings (G.new_settings ) #define cin_fileno (G.cin_fileno ) +#define INIT_G() do { setup_common_bufsiz(); } while (0) #define setTermSettings(fd, argp) \ do { \ diff --git a/util-linux/mount.c b/util-linux/mount.c index e5c85fe..244f4fa 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -457,7 +457,7 @@ enum { GETMNTENT_BUFSIZE = COMMON_BUFSIZE - offsetof(struct globals, getmntent_b #endif #define fslist (G.fslist ) #define getmntent_buf (G.getmntent_buf ) -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) #if ENABLE_FEATURE_MTAB_SUPPORT /* diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index 43228a6..6713852 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c @@ -72,7 +72,7 @@ struct globals { #define save_g_flags() ((void)0) #define restore_g_flags() ((void)0) #endif -#define INIT_G() do { } while (0) +#define INIT_G() do { setup_common_bufsiz(); } while (0) #define do_swapoff (applet_name[5] == 'f') diff --git a/util-linux/uevent.c b/util-linux/uevent.c index 58668fa..b98fe61 100644 --- a/util-linux/uevent.c +++ b/util-linux/uevent.c @@ -31,6 +31,7 @@ #define BUFFER_SIZE 16*1024 #define env ((char **)bb_common_bufsiz1) +#define INIT_G() do { setup_common_bufsiz(); } while (0) enum { MAX_ENV = COMMON_BUFSIZE / sizeof(env[0]) - 1, }; @@ -46,6 +47,8 @@ int uevent_main(int argc UNUSED_PARAM, char **argv) struct sockaddr_nl sa; int fd; + INIT_G(); + argv++; // Subscribe for UEVENT kernel messages |