aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-04-21 18:38:51 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-04-21 18:38:51 +0200
commit9de2e5a22213842da5b116723392de88de9ed419 (patch)
treedff999a566382174e084d377dc3b4c03de1d4c62
parent47cfbf32fd66563f8c4e09ad6cced6abfbe2fad5 (diff)
downloadbusybox-9de2e5a22213842da5b116723392de88de9ed419.tar.gz
*: hopefully all setup_common_bufsiz() are in place
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/tar.c2
-rw-r--r--console-tools/dumpkmap.c1
-rw-r--r--coreutils/catv.c4
-rw-r--r--coreutils/cksum.c6
-rw-r--r--coreutils/date.c6
-rw-r--r--coreutils/split.c2
-rw-r--r--coreutils/stat.c7
-rw-r--r--coreutils/sum.c4
-rw-r--r--coreutils/tee.c6
-rw-r--r--editors/diff.c1
-rw-r--r--editors/ed.c8
-rw-r--r--miscutils/chat.c3
-rw-r--r--miscutils/conspy.c7
-rw-r--r--miscutils/fbsplash.c7
-rw-r--r--miscutils/inotifyd.c6
-rw-r--r--miscutils/less.c7
-rw-r--r--miscutils/microcom.c6
-rw-r--r--networking/httpd.c1
-rw-r--r--networking/isrv_identd.c7
-rw-r--r--networking/libiproute/ipaddress.c5
-rw-r--r--networking/libiproute/ipneigh.c3
-rw-r--r--networking/libiproute/iproute.c3
-rw-r--r--networking/nc.c3
-rw-r--r--procps/nmeter.c9
-rw-r--r--runit/svlogd.c4
-rw-r--r--sysklogd/klogd.c7
-rw-r--r--sysklogd/logger.c2
-rw-r--r--util-linux/script.c10
-rw-r--r--util-linux/umount.c1
29 files changed, 83 insertions, 55 deletions
diff --git a/archival/tar.c b/archival/tar.c
index caf4363de..346a9404e 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -162,6 +162,7 @@
#define block_buf bb_common_bufsiz1
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
#if ENABLE_FEATURE_TAR_CREATE
@@ -964,6 +965,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
#if ENABLE_FEATURE_TAR_LONG_OPTIONS && ENABLE_FEATURE_TAR_FROM
llist_t *excludes = NULL;
#endif
+ INIT_G();
/* Initialise default values */
tar_handle = init_handle();
diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c
index 6412dffc8..b6fd466dc 100644
--- a/console-tools/dumpkmap.c
+++ b/console-tools/dumpkmap.c
@@ -38,6 +38,7 @@ int dumpkmap_main(int argc UNUSED_PARAM, char **argv)
struct kbentry ke;
int i, j, fd;
#define flags bb_common_bufsiz1
+ setup_common_bufsiz();
/* When user accidentally runs "dumpkmap FILE"
* instead of "dumpkmap >FILE", we'd dump binary stuff to tty.
diff --git a/coreutils/catv.c b/coreutils/catv.c
index 801d2451d..0e71368a5 100644
--- a/coreutils/catv.c
+++ b/coreutils/catv.c
@@ -49,6 +49,9 @@ int catv_main(int argc UNUSED_PARAM, char **argv)
/* Read from stdin if there's nothing else to do. */
if (!argv[0])
*--argv = (char*)"-";
+
+#define read_buf bb_common_bufsiz1
+ setup_common_bufsiz();
do {
fd = open_or_warn_stdin(*argv);
if (fd < 0) {
@@ -58,7 +61,6 @@ int catv_main(int argc UNUSED_PARAM, char **argv)
for (;;) {
int i, res;
-#define read_buf bb_common_bufsiz1
res = read(fd, read_buf, COMMON_BUFSIZE);
if (res < 0)
retval = EXIT_FAILURE;
diff --git a/coreutils/cksum.c b/coreutils/cksum.c
index d8351e7c6..8a8a39f68 100644
--- a/coreutils/cksum.c
+++ b/coreutils/cksum.c
@@ -33,6 +33,7 @@ int cksum_main(int argc UNUSED_PARAM, char **argv)
argv++;
#endif
+ setup_common_bufsiz();
do {
int fd = open_or_warn_stdin(*argv ? *argv : bb_msg_standard_input);
@@ -43,9 +44,8 @@ int cksum_main(int argc UNUSED_PARAM, char **argv)
crc = 0;
length = 0;
-#define read_buf bb_common_bufsiz1
-#define sizeof_read_buf COMMON_BUFSIZE
- while ((bytes_read = safe_read(fd, read_buf, sizeof_read_buf)) > 0) {
+#define read_buf bb_common_bufsiz1
+ while ((bytes_read = safe_read(fd, read_buf, COMMON_BUFSIZE)) > 0) {
length += bytes_read;
crc = crc32_block_endian1(crc, read_buf, bytes_read, crc32_table);
}
diff --git a/coreutils/date.c b/coreutils/date.c
index 59b4b8f2a..ff3214d85 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -368,8 +368,8 @@ int date_main(int argc UNUSED_PARAM, char **argv)
}
#endif
-#define date_buf bb_common_bufsiz1
-#define sizeof_date_buf COMMON_BUFSIZE
+#define date_buf bb_common_bufsiz1
+ setup_common_bufsiz();
if (*fmt_dt2str == '\0') {
/* With no format string, just print a blank line */
date_buf[0] = '\0';
@@ -379,7 +379,7 @@ int date_main(int argc UNUSED_PARAM, char **argv)
fmt_dt2str = (char*)"%Y.%m.%d-%H:%M:%S";
}
/* Generate output string */
- strftime(date_buf, sizeof_date_buf, fmt_dt2str, &tm_time);
+ strftime(date_buf, COMMON_BUFSIZE, fmt_dt2str, &tm_time);
}
puts(date_buf);
diff --git a/coreutils/split.c b/coreutils/split.c
index b2da74e27..e67c3de66 100644
--- a/coreutils/split.c
+++ b/coreutils/split.c
@@ -79,6 +79,8 @@ int split_main(int argc UNUSED_PARAM, char **argv)
ssize_t bytes_read, to_write;
char *src;
+ setup_common_bufsiz();
+
opt_complementary = "?2:a+"; /* max 2 args; -a N */
opt = getopt32(argv, "l:b:a:", &count_p, &count_p, &suffix_len);
diff --git a/coreutils/stat.c b/coreutils/stat.c
index 78df9c948..ddcfcf2d7 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -158,10 +158,9 @@ static const char *human_time(time_t t)
/* coreutils 6.3 compat: */
/*static char buf[sizeof("YYYY-MM-DD HH:MM:SS.000000000")] ALIGN1;*/
-#define buf bb_common_bufsiz1
-#define sizeof_buf COMMON_BUFSIZE
-
- strcpy(strftime_YYYYMMDDHHMMSS(buf, sizeof_buf, &t), ".000000000");
+#define buf bb_common_bufsiz1
+ setup_common_bufsiz();
+ strcpy(strftime_YYYYMMDDHHMMSS(buf, COMMON_BUFSIZE, &t), ".000000000");
return buf;
#undef buf
}
diff --git a/coreutils/sum.c b/coreutils/sum.c
index cc6677221..ec9ed2a11 100644
--- a/coreutils/sum.c
+++ b/coreutils/sum.c
@@ -31,12 +31,14 @@ enum { SUM_BSD, PRINT_NAME, SUM_SYSV };
/* Return 1 if successful. */
static unsigned sum_file(const char *file, unsigned type)
{
-#define buf bb_common_bufsiz1
unsigned long long total_bytes = 0;
int fd, r;
/* The sum of all the input bytes, modulo (UINT_MAX + 1). */
unsigned s = 0;
+#define buf bb_common_bufsiz1
+ setup_common_bufsiz();
+
fd = open_or_warn_stdin(file);
if (fd == -1)
return 0;
diff --git a/coreutils/tee.c b/coreutils/tee.c
index a0e177cbc..a68e9446f 100644
--- a/coreutils/tee.c
+++ b/coreutils/tee.c
@@ -37,8 +37,8 @@ int tee_main(int argc, char **argv)
//TODO: make unconditional
#if ENABLE_FEATURE_TEE_USE_BLOCK_IO
ssize_t c;
-# define buf bb_common_bufsiz1
-# define sizeof_buf COMMON_BUFSIZE
+# define buf bb_common_bufsiz1
+ setup_common_bufsiz();
#else
int c;
#endif
@@ -81,7 +81,7 @@ int tee_main(int argc, char **argv)
/* names[0] will be filled later */
#if ENABLE_FEATURE_TEE_USE_BLOCK_IO
- while ((c = safe_read(STDIN_FILENO, buf, sizeof_buf)) > 0) {
+ while ((c = safe_read(STDIN_FILENO, buf, COMMON_BUFSIZE)) > 0) {
fp = files;
do
fwrite(buf, 1, c, *fp);
diff --git a/editors/diff.c b/editors/diff.c
index 3c8e9074a..ff269360f 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -749,6 +749,7 @@ static int diffreg(char *file[2])
fp[i] = fdopen(fd, "r");
}
+ setup_common_bufsiz();
while (1) {
const size_t sz = COMMON_BUFSIZE / 2;
char *const buf0 = bb_common_bufsiz1;
diff --git a/editors/ed.c b/editors/ed.c
index 8da7b1dd5..c028b78cb 100644
--- a/editors/ed.c
+++ b/editors/ed.c
@@ -33,12 +33,11 @@ typedef struct LINE {
} LINE;
-#define searchString bb_common_bufsiz1
-#define sizeof_searchString COMMON_BUFSIZE
+#define searchString bb_common_bufsiz1
enum {
- USERSIZE = sizeof_searchString > 1024 ? 1024
- : sizeof_searchString - 1, /* max line length typed in by user */
+ USERSIZE = COMMON_BUFSIZE > 1024 ? 1024
+ : COMMON_BUFSIZE - 1, /* max line length typed in by user */
INITBUF_SIZE = 1024, /* initial buffer size */
};
@@ -68,6 +67,7 @@ struct globals {
#define lines (G.lines )
#define marks (G.marks )
#define INIT_G() do { \
+ setup_common_bufsiz(); \
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
} while (0)
diff --git a/miscutils/chat.c b/miscutils/chat.c
index 25850dd20..6b429f2a6 100644
--- a/miscutils/chat.c
+++ b/miscutils/chat.c
@@ -286,9 +286,10 @@ int chat_main(int argc UNUSED_PARAM, char **argv)
&& poll(&pfd, 1, timeout) > 0
&& (pfd.revents & POLLIN)
) {
-#define buf bb_common_bufsiz1
llist_t *l;
ssize_t delta;
+#define buf bb_common_bufsiz1
+ setup_common_bufsiz();
// read next char from device
if (safe_read(STDIN_FILENO, buf+buf_len, 1) > 0) {
diff --git a/miscutils/conspy.c b/miscutils/conspy.c
index 0d96a5f9a..f6468c116 100644
--- a/miscutils/conspy.c
+++ b/miscutils/conspy.c
@@ -364,8 +364,6 @@ int conspy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int conspy_main(int argc UNUSED_PARAM, char **argv)
{
char tty_name[sizeof(DEV_TTY "NN")];
-#define keybuf bb_common_bufsiz1
-#define sizeof_keybuf COMMON_BUFSIZE
struct termios termbuf;
unsigned opts;
unsigned ttynum;
@@ -384,6 +382,9 @@ int conspy_main(int argc UNUSED_PARAM, char **argv)
applet_long_options = getopt_longopts;
#endif
+#define keybuf bb_common_bufsiz1
+ setup_common_bufsiz();
+
INIT_G();
strcpy(G.vcsa_name, DEV_VCSA);
@@ -515,7 +516,7 @@ int conspy_main(int argc UNUSED_PARAM, char **argv)
default:
// Read the keys pressed
k = keybuf + G.key_count;
- bytes_read = read(G.kbd_fd, k, sizeof_keybuf - G.key_count);
+ bytes_read = read(G.kbd_fd, k, COMMON_BUFSIZE - G.key_count);
if (bytes_read < 0)
goto abort;
diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
index b26ad2c15..3ddf8a242 100644
--- a/miscutils/fbsplash.c
+++ b/miscutils/fbsplash.c
@@ -373,12 +373,13 @@ static void fb_drawimage(void)
* - A raster of Width * Height pixels in triplets of rgb
* in pure binary by 1 or 2 bytes. (we support only 1 byte)
*/
-#define concat_buf bb_common_bufsiz1
-#define sizeof_concat_buf COMMON_BUFSIZE
+#define concat_buf bb_common_bufsiz1
+ setup_common_bufsiz();
+
read_ptr = concat_buf;
while (1) {
int w, h, max_color_val;
- int rem = concat_buf + sizeof_concat_buf - read_ptr;
+ int rem = concat_buf + COMMON_BUFSIZE - read_ptr;
if (rem < 2
|| fgets(read_ptr, rem, theme_file) == NULL
) {
diff --git a/miscutils/inotifyd.c b/miscutils/inotifyd.c
index 1d28e8f99..52db08ada 100644
--- a/miscutils/inotifyd.c
+++ b/miscutils/inotifyd.c
@@ -162,10 +162,10 @@ int inotifyd_main(int argc, char **argv)
// read out all pending events
// (NB: len must be int, not ssize_t or long!)
+#define eventbuf bb_common_bufsiz1
+ setup_common_bufsiz();
xioctl(pfd.fd, FIONREAD, &len);
-#define eventbuf bb_common_bufsiz1
-#define sizeof_eventbuf COMMON_BUFSIZE
- ie = buf = (len <= sizeof_eventbuf) ? eventbuf : xmalloc(len);
+ ie = buf = (len <= COMMON_BUFSIZE) ? eventbuf : xmalloc(len);
len = full_read(pfd.fd, buf, len);
// process events. N.B. events may vary in length
while (len > 0) {
diff --git a/miscutils/less.c b/miscutils/less.c
index 94ecf1686..d7076dbbc 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -440,8 +440,6 @@ static int at_end(void)
*/
static void read_lines(void)
{
-#define readbuf bb_common_bufsiz1
-#define sizeof_readbuf COMMON_BUFSIZE
char *current_line, *p;
int w = width;
char last_terminated = terminated;
@@ -451,6 +449,9 @@ static void read_lines(void)
unsigned old_max_fline = max_fline;
#endif
+#define readbuf bb_common_bufsiz1
+ setup_common_bufsiz();
+
/* (careful: max_fline can be -1) */
if (max_fline + 1 > MAXLINES)
return;
@@ -482,7 +483,7 @@ static void read_lines(void)
time_t t;
errno = 0;
- eof_error = safe_read(STDIN_FILENO, readbuf, sizeof_readbuf);
+ eof_error = safe_read(STDIN_FILENO, readbuf, COMMON_BUFSIZE);
if (errno != EAGAIN)
break;
t = time(NULL);
diff --git a/miscutils/microcom.c b/miscutils/microcom.c
index 5eb2e6743..d9e8f9187 100644
--- a/miscutils/microcom.c
+++ b/miscutils/microcom.c
@@ -156,11 +156,11 @@ int microcom_main(int argc UNUSED_PARAM, char **argv)
skip_write: ;
}
if (pfd[0].revents) {
-#define iobuf bb_common_bufsiz1
-#define sizeof_iobuf COMMON_BUFSIZE
ssize_t len;
+#define iobuf bb_common_bufsiz1
+ setup_common_bufsiz();
// read from device -> write to stdout
- len = safe_read(sfd, iobuf, sizeof_iobuf);
+ len = safe_read(sfd, iobuf, COMMON_BUFSIZE);
if (len > 0)
full_write(STDOUT_FILENO, iobuf, len);
else {
diff --git a/networking/httpd.c b/networking/httpd.c
index ef90770ac..abe83a458 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -370,6 +370,7 @@ enum {
# define content_gzip 0
#endif
#define INIT_G() do { \
+ setup_common_bufsiz(); \
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
IF_FEATURE_HTTPD_BASIC_AUTH(g_realm = "Web Server Authentication";) \
IF_FEATURE_HTTPD_RANGES(range_start = -1;) \
diff --git a/networking/isrv_identd.c b/networking/isrv_identd.c
index f63ed8ee4..8a15926e5 100644
--- a/networking/isrv_identd.c
+++ b/networking/isrv_identd.c
@@ -29,8 +29,7 @@ typedef struct identd_buf_t {
char buf[64 - sizeof(int)];
} identd_buf_t;
-#define bogouser bb_common_bufsiz1
-#define sizeof_bogouser COMMON_BUFSIZE
+#define bogouser bb_common_bufsiz1
static int new_peer(isrv_state_t *state, int fd)
{
@@ -117,10 +116,12 @@ int fakeidentd_main(int argc UNUSED_PARAM, char **argv)
unsigned opt;
int fd;
+ setup_common_bufsiz();
+
opt = getopt32(argv, "fiwb:", &bind_address);
strcpy(bogouser, "nobody");
if (argv[optind])
- strncpy(bogouser, argv[optind], sizeof_bogouser - 1);
+ strncpy(bogouser, argv[optind], COMMON_BUFSIZE - 1);
/* Daemonize if no -f and no -i and no -w */
if (!(opt & OPT_fiw))
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c
index 2c0f514c7..d9e099607 100644
--- a/networking/libiproute/ipaddress.c
+++ b/networking/libiproute/ipaddress.c
@@ -41,7 +41,7 @@ struct filter_t {
typedef struct filter_t filter_t;
#define G_filter (*(filter_t*)bb_common_bufsiz1)
-
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
static void print_link_flags(unsigned flags, unsigned mdown)
{
@@ -745,6 +745,9 @@ int FAST_FUNC do_ipaddr(char **argv)
/* 0 1 2 3 4 5 6 7 8 */
"add\0""change\0""chg\0""replace\0""delete\0""list\0""show\0""lst\0""flush\0";
int cmd = 2;
+
+ INIT_G();
+
if (*argv) {
cmd = index_in_substrings(commands, *argv);
if (cmd < 0)
diff --git a/networking/libiproute/ipneigh.c b/networking/libiproute/ipneigh.c
index 151d3d109..d2028b7b6 100644
--- a/networking/libiproute/ipneigh.c
+++ b/networking/libiproute/ipneigh.c
@@ -42,6 +42,7 @@ struct filter_t {
typedef struct filter_t filter_t;
#define G_filter (*(filter_t*)bb_common_bufsiz1)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
static int flush_update(void)
{
@@ -339,6 +340,8 @@ int FAST_FUNC do_ipneigh(char **argv)
/*0-1*/ "show\0" "flush\0";
int command_num;
+ INIT_G();
+
if (!*argv)
return ipneigh_list_or_flush(argv, 0);
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index 34d4f4758..e674e9a0d 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -45,6 +45,7 @@ struct filter_t {
typedef struct filter_t filter_t;
#define G_filter (*(filter_t*)bb_common_bufsiz1)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
static int flush_update(void)
{
@@ -903,6 +904,8 @@ int FAST_FUNC do_iproute(char **argv)
unsigned flags = 0;
int cmd = RTM_NEWROUTE;
+ INIT_G();
+
if (!*argv)
return iproute_list_or_flush(argv, 0);
diff --git a/networking/nc.c b/networking/nc.c
index 50edee450..13a9b48a8 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -239,6 +239,8 @@ int nc_main(int argc, char **argv)
FD_SET(cfd, &readfds);
FD_SET(STDIN_FILENO, &readfds);
+#define iobuf bb_common_bufsiz1
+ setup_common_bufsiz();
for (;;) {
int fd;
int ofd;
@@ -249,7 +251,6 @@ int nc_main(int argc, char **argv)
if (select(cfd + 1, &testfds, NULL, NULL, NULL) < 0)
bb_perror_msg_and_die("select");
-#define iobuf bb_common_bufsiz1
fd = STDIN_FILENO;
while (1) {
if (FD_ISSET(fd, &testfds)) {
diff --git a/procps/nmeter.c b/procps/nmeter.c
index efa3d553d..3eac2d3b2 100644
--- a/procps/nmeter.c
+++ b/procps/nmeter.c
@@ -109,16 +109,15 @@ struct globals {
#define proc_meminfo (G.proc_meminfo )
#define proc_diskstats (G.proc_diskstats )
#define proc_sys_fs_filenr (G.proc_sys_fs_filenr)
+#define outbuf bb_common_bufsiz1
#define INIT_G() do { \
+ setup_common_bufsiz(); \
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
cur_outbuf = outbuf; \
G.final_char = '\n'; \
G.deltanz = G.delta = 1000000; \
} while (0)
-#define outbuf bb_common_bufsiz1
-#define sizeof_outbuf COMMON_BUFSIZE
-
static inline void reset_outbuf(void)
{
cur_outbuf = outbuf;
@@ -141,7 +140,7 @@ static void print_outbuf(void)
static void put(const char *s)
{
char *p = cur_outbuf;
- int sz = outbuf + sizeof_outbuf - p;
+ int sz = outbuf + COMMON_BUFSIZE - p;
while (*s && --sz >= 0)
*p++ = *s++;
cur_outbuf = p;
@@ -149,7 +148,7 @@ static void put(const char *s)
static void put_c(char c)
{
- if (cur_outbuf < outbuf + sizeof_outbuf)
+ if (cur_outbuf < outbuf + COMMON_BUFSIZE)
*cur_outbuf++ = c;
}
diff --git a/runit/svlogd.c b/runit/svlogd.c
index 09efdb695..7cae81cb2 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -234,7 +234,9 @@ struct globals {
#define blocked_sigset (G.blocked_sigset)
#define fl_flag_0 (G.fl_flag_0 )
#define dirn (G.dirn )
+#define line bb_common_bufsiz1
#define INIT_G() do { \
+ setup_common_bufsiz(); \
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
linemax = 1000; \
/*buflen = 1024;*/ \
@@ -242,8 +244,6 @@ struct globals {
replace = ""; \
} while (0)
-#define line bb_common_bufsiz1
-
#define FATAL "fatal: "
#define WARNING "warning: "
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index 845c49a5e..4db72110d 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -146,10 +146,9 @@ static void klogd_close(void)
#endif
-#define log_buffer bb_common_bufsiz1
-#define sizeof_log_buffer COMMON_BUFSIZE
+#define log_buffer bb_common_bufsiz1
enum {
- KLOGD_LOGBUF_SIZE = sizeof_log_buffer,
+ KLOGD_LOGBUF_SIZE = COMMON_BUFSIZE,
OPT_LEVEL = (1 << 0),
OPT_FOREGROUND = (1 << 1),
};
@@ -175,6 +174,8 @@ int klogd_main(int argc UNUSED_PARAM, char **argv)
int opt;
int used;
+ setup_common_bufsiz();
+
opt = getopt32(argv, "c:n", &opt_c);
if (opt & OPT_LEVEL) {
/* Valid levels are between 1 and 8 */
diff --git a/sysklogd/logger.c b/sysklogd/logger.c
index b3ca85703..f9eafeb25 100644
--- a/sysklogd/logger.c
+++ b/sysklogd/logger.c
@@ -99,6 +99,8 @@ int logger_main(int argc UNUSED_PARAM, char **argv)
int opt;
int i = 0;
+ setup_common_bufsiz();
+
/* Fill out the name string early (may be overwritten later) */
str_t = uid2uname_utoa(geteuid());
diff --git a/util-linux/script.c b/util-linux/script.c
index 6195161bc..86475c1f1 100644
--- a/util-linux/script.c
+++ b/util-linux/script.c
@@ -109,12 +109,12 @@ int script_main(int argc UNUSED_PARAM, char **argv)
if (child_pid) {
/* parent */
-#define buf bb_common_bufsiz1
-#define sizeof_buf COMMON_BUFSIZE
struct pollfd pfd[2];
int outfd, count, loop;
double oldtime = ENABLE_SCRIPTREPLAY ? time(NULL) : 0;
smallint fd_count = 2;
+#define buf bb_common_bufsiz1
+ setup_common_bufsiz();
outfd = xopen(fname, mode);
pfd[0].fd = pty;
@@ -136,7 +136,7 @@ int script_main(int argc UNUSED_PARAM, char **argv)
}
if (pfd[0].revents) {
errno = 0;
- count = safe_read(pty, buf, sizeof_buf);
+ count = safe_read(pty, buf, COMMON_BUFSIZE);
if (count <= 0 && errno != EAGAIN) {
/* err/eof from pty: exit */
goto restore;
@@ -159,7 +159,7 @@ int script_main(int argc UNUSED_PARAM, char **argv)
}
}
if (pfd[1].revents) {
- count = safe_read(STDIN_FILENO, buf, sizeof_buf);
+ count = safe_read(STDIN_FILENO, buf, COMMON_BUFSIZE);
if (count <= 0) {
/* err/eof from stdin: don't read stdin anymore */
pfd[1].revents = 0;
@@ -178,7 +178,7 @@ int script_main(int argc UNUSED_PARAM, char **argv)
* (util-linux's script doesn't do this. buggy :) */
loop = 999;
/* pty is in O_NONBLOCK mode, we exit as soon as buffer is empty */
- while (--loop && (count = safe_read(pty, buf, sizeof_buf)) > 0) {
+ while (--loop && (count = safe_read(pty, buf, COMMON_BUFSIZE)) > 0) {
full_write(STDOUT_FILENO, buf, count);
full_write(outfd, buf, count);
}
diff --git a/util-linux/umount.c b/util-linux/umount.c
index be0300394..91da69674 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -103,6 +103,7 @@ int umount_main(int argc UNUSED_PARAM, char **argv)
if (opt & OPT_ALL)
bb_error_msg_and_die("can't open '%s'", bb_path_mtab_file);
} else {
+ setup_common_bufsiz();
while (getmntent_r(fp, &me, bb_common_bufsiz1, COMMON_BUFSIZE)) {
/* Match fstype if passed */
if (!match_fstype(&me, fstype))