diff options
-rw-r--r-- | coreutils/dos2unix.c | 3 | ||||
-rw-r--r-- | coreutils/tee.c | 6 | ||||
-rw-r--r-- | coreutils/tr.c | 9 | ||||
-rw-r--r-- | editors/vi.c | 3 | ||||
-rw-r--r-- | include/libbb.h | 6 | ||||
-rw-r--r-- | libbb/Makefile.in | 3 | ||||
-rw-r--r-- | libbb/messages.c | 3 | ||||
-rw-r--r-- | loginutils/getty.c | 19 | ||||
-rw-r--r-- | loginutils/sulogin.c | 8 | ||||
-rw-r--r-- | networking/nc.c | 4 | ||||
-rw-r--r-- | shell/ash.c | 3 |
11 files changed, 34 insertions, 33 deletions
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c index 0c419aca7..0464df76f 100644 --- a/coreutils/dos2unix.c +++ b/coreutils/dos2unix.c | |||
@@ -44,12 +44,13 @@ | |||
44 | * to pick a random letter to add to out temporary file. */ | 44 | * to pick a random letter to add to out temporary file. */ |
45 | typedef unsigned long int bb_uint64_t; | 45 | typedef unsigned long int bb_uint64_t; |
46 | 46 | ||
47 | #define tempFn bb_common_bufsiz1 | ||
48 | |||
47 | /* if fn is NULL then input is stdin and output is stdout */ | 49 | /* if fn is NULL then input is stdin and output is stdout */ |
48 | static int convert(char *fn, int ConvType) | 50 | static int convert(char *fn, int ConvType) |
49 | { | 51 | { |
50 | int c, fd; | 52 | int c, fd; |
51 | struct timeval tv; | 53 | struct timeval tv; |
52 | RESERVE_CONFIG_BUFFER(tempFn, BUFSIZ); | ||
53 | static bb_uint64_t value=0; | 54 | static bb_uint64_t value=0; |
54 | FILE *in, *out; | 55 | FILE *in, *out; |
55 | 56 | ||
diff --git a/coreutils/tee.c b/coreutils/tee.c index ba2e10f90..1160fc9dd 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c | |||
@@ -39,7 +39,7 @@ int tee_main(int argc, char **argv) | |||
39 | int retval = EXIT_SUCCESS; | 39 | int retval = EXIT_SUCCESS; |
40 | #ifdef CONFIG_FEATURE_TEE_USE_BLOCK_IO | 40 | #ifdef CONFIG_FEATURE_TEE_USE_BLOCK_IO |
41 | ssize_t c; | 41 | ssize_t c; |
42 | RESERVE_CONFIG_BUFFER(buf, BUFSIZ); | 42 | # define buf bb_common_bufsiz1 |
43 | #else | 43 | #else |
44 | int c; | 44 | int c; |
45 | #endif | 45 | #endif |
@@ -88,10 +88,6 @@ int tee_main(int argc, char **argv) | |||
88 | retval = EXIT_FAILURE; | 88 | retval = EXIT_FAILURE; |
89 | } | 89 | } |
90 | 90 | ||
91 | #ifdef CONFIG_FEATURE_CLEAN_UP | ||
92 | RELEASE_CONFIG_BUFFER(buf); | ||
93 | #endif | ||
94 | |||
95 | #else | 91 | #else |
96 | setvbuf(stdout, NULL, _IONBF, 0); | 92 | setvbuf(stdout, NULL, _IONBF, 0); |
97 | while ((c = getchar()) != EOF) { | 93 | while ((c = getchar()) != EOF) { |
diff --git a/coreutils/tr.c b/coreutils/tr.c index 6e3f97b36..e9eca4c60 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c | |||
@@ -38,10 +38,11 @@ | |||
38 | static char com_fl, del_fl, sq_fl; | 38 | static char com_fl, del_fl, sq_fl; |
39 | static short in_index, out_index; | 39 | static short in_index, out_index; |
40 | /* these last are pointers to static buffers declared in tr_main */ | 40 | /* these last are pointers to static buffers declared in tr_main */ |
41 | static unsigned char *poutput, *pinput; | 41 | static unsigned char *poutput; |
42 | static unsigned char *pvector; | 42 | static unsigned char *pvector; |
43 | static char *pinvec, *poutvec; | 43 | static char *pinvec, *poutvec; |
44 | 44 | ||
45 | #define input bb_common_bufsiz1 | ||
45 | 46 | ||
46 | static void convert(void) | 47 | static void convert(void) |
47 | { | 48 | { |
@@ -51,14 +52,14 @@ static void convert(void) | |||
51 | 52 | ||
52 | for (;;) { | 53 | for (;;) { |
53 | if (in_index == read_chars) { | 54 | if (in_index == read_chars) { |
54 | if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) { | 55 | if ((read_chars = read(0, input, BUFSIZ)) <= 0) { |
55 | if (write(1, (char *) poutput, out_index) != out_index) | 56 | if (write(1, (char *) poutput, out_index) != out_index) |
56 | bb_error_msg(bb_msg_write_error); | 57 | bb_error_msg(bb_msg_write_error); |
57 | exit(0); | 58 | exit(0); |
58 | } | 59 | } |
59 | in_index = 0; | 60 | in_index = 0; |
60 | } | 61 | } |
61 | c = pinput[in_index++]; | 62 | c = input[in_index++]; |
62 | coded = pvector[c]; | 63 | coded = pvector[c]; |
63 | if (del_fl && pinvec[c]) | 64 | if (del_fl && pinvec[c]) |
64 | continue; | 65 | continue; |
@@ -208,14 +209,12 @@ extern int tr_main(int argc, char **argv) | |||
208 | int idx = 1; | 209 | int idx = 1; |
209 | int i; | 210 | int i; |
210 | RESERVE_CONFIG_BUFFER(output, BUFSIZ); | 211 | RESERVE_CONFIG_BUFFER(output, BUFSIZ); |
211 | RESERVE_CONFIG_BUFFER(input, BUFSIZ); | ||
212 | RESERVE_CONFIG_UBUFFER(vector, ASCII+1); | 212 | RESERVE_CONFIG_UBUFFER(vector, ASCII+1); |
213 | RESERVE_CONFIG_BUFFER(invec, ASCII+1); | 213 | RESERVE_CONFIG_BUFFER(invec, ASCII+1); |
214 | RESERVE_CONFIG_BUFFER(outvec, ASCII+1); | 214 | RESERVE_CONFIG_BUFFER(outvec, ASCII+1); |
215 | 215 | ||
216 | /* ... but make them available globally */ | 216 | /* ... but make them available globally */ |
217 | poutput = output; | 217 | poutput = output; |
218 | pinput = input; | ||
219 | pvector = vector; | 218 | pvector = vector; |
220 | pinvec = invec; | 219 | pinvec = invec; |
221 | poutvec = outvec; | 220 | poutvec = outvec; |
diff --git a/editors/vi.c b/editors/vi.c index 1cc127036..e6c87560d 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -2226,7 +2226,8 @@ static int mysleep(int hund) // sleep for 'h' 1/100 seconds | |||
2226 | return (FD_ISSET(0, &rfds)); | 2226 | return (FD_ISSET(0, &rfds)); |
2227 | } | 2227 | } |
2228 | 2228 | ||
2229 | static Byte readbuffer[BUFSIZ]; | 2229 | #define readbuffer bb_common_bufsiz1 |
2230 | |||
2230 | static int readed_for_parse; | 2231 | static int readed_for_parse; |
2231 | 2232 | ||
2232 | //----- IO Routines -------------------------------------------- | 2233 | //----- IO Routines -------------------------------------------- |
diff --git a/include/libbb.h b/include/libbb.h index e3087db18..b7dd48775 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -333,6 +333,12 @@ extern const char * const bb_path_group_file; | |||
333 | extern const char * const bb_path_securetty_file; | 333 | extern const char * const bb_path_securetty_file; |
334 | extern const char * const bb_path_motd_file; | 334 | extern const char * const bb_path_motd_file; |
335 | extern const char * const bb_dev_null; | 335 | extern const char * const bb_dev_null; |
336 | |||
337 | #ifndef BUFSIZ | ||
338 | #define BUFSIZ 4096 | ||
339 | #endif | ||
340 | extern char bb_common_bufsiz1[BUFSIZ+1]; | ||
341 | |||
336 | /* | 342 | /* |
337 | * You can change LIBBB_DEFAULT_LOGIN_SHELL, but don`t use, | 343 | * You can change LIBBB_DEFAULT_LOGIN_SHELL, but don`t use, |
338 | * use bb_default_login_shell and next defines, | 344 | * use bb_default_login_shell and next defines, |
diff --git a/libbb/Makefile.in b/libbb/Makefile.in index 69f8779d2..fb4910018 100644 --- a/libbb/Makefile.in +++ b/libbb/Makefile.in | |||
@@ -47,7 +47,8 @@ LIBBB_MOBJ0:=full_version.o \ | |||
47 | can_not_create_raw_socket.o perm_denied_are_you_root.o \ | 47 | can_not_create_raw_socket.o perm_denied_are_you_root.o \ |
48 | shadow_file.o passwd_file.o group_file.o gshadow_file.o nologin_file.o \ | 48 | shadow_file.o passwd_file.o group_file.o gshadow_file.o nologin_file.o \ |
49 | securetty_file.o motd_file.o \ | 49 | securetty_file.o motd_file.o \ |
50 | msg_standard_input.o msg_standard_output.o shell_file.o bb_dev_null.o | 50 | msg_standard_input.o msg_standard_output.o shell_file.o \ |
51 | bb_dev_null.o bb_common_bufsiz1.o | ||
51 | 52 | ||
52 | LIBBB_MSRC1:=$(srcdir)/xfuncs.c | 53 | LIBBB_MSRC1:=$(srcdir)/xfuncs.c |
53 | LIBBB_MOBJ1:=xmalloc.o xrealloc.o xcalloc.o xstrdup.o xstrndup.o \ | 54 | LIBBB_MOBJ1:=xmalloc.o xrealloc.o xcalloc.o xstrdup.o xstrndup.o \ |
diff --git a/libbb/messages.c b/libbb/messages.c index 9a77aa64b..e11dddc50 100644 --- a/libbb/messages.c +++ b/libbb/messages.c | |||
@@ -101,3 +101,6 @@ const char * const bb_default_login_shell = LIBBB_DEFAULT_LOGIN_SHELL; | |||
101 | const char * const bb_dev_null = "/dev/null"; | 101 | const char * const bb_dev_null = "/dev/null"; |
102 | #endif | 102 | #endif |
103 | 103 | ||
104 | #ifdef L_bb_common_bufsiz1 | ||
105 | char bb_common_bufsiz1[BUFSIZ+1]; | ||
106 | #endif | ||
diff --git a/loginutils/getty.c b/loginutils/getty.c index db9a150e0..e8643ef93 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c | |||
@@ -113,15 +113,6 @@ extern void updwtmp(const char *filename, const struct utmp *ut); | |||
113 | #endif | 113 | #endif |
114 | 114 | ||
115 | /* | 115 | /* |
116 | * This program tries to not use the standard-i/o library. This keeps the | ||
117 | * executable small on systems that do not have shared libraries (System V | ||
118 | * Release <3). | ||
119 | */ | ||
120 | #ifndef BUFSIZ | ||
121 | #define BUFSIZ 1024 | ||
122 | #endif | ||
123 | |||
124 | /* | ||
125 | * When multiple baud rates are specified on the command line, the first one | 116 | * When multiple baud rates are specified on the command line, the first one |
126 | * we will try is the first one specified. | 117 | * we will try is the first one specified. |
127 | */ | 118 | */ |
@@ -744,12 +735,12 @@ static void next_speed(struct termio *tp, struct options *op) | |||
744 | /* return NULL on failure, logname on success */ | 735 | /* return NULL on failure, logname on success */ |
745 | static char *get_logname(struct options *op, struct chardata *cp, struct termio *tp) | 736 | static char *get_logname(struct options *op, struct chardata *cp, struct termio *tp) |
746 | { | 737 | { |
747 | static char logname[BUFSIZ]; | 738 | #define logname bb_common_bufsiz1 |
748 | char *bp; | 739 | char *bp; |
749 | char c; /* input character, full eight bits */ | 740 | char c; /* input character, full eight bits */ |
750 | char ascval; /* low 7 bits of input character */ | 741 | char ascval; /* low 7 bits of input character */ |
751 | int bits; /* # of "1" bits per character */ | 742 | int bits; /* # of "1" bits per character */ |
752 | int mask; /* mask with 1 bit up */ | 743 | int mask; /* mask with 1 bit up */ |
753 | static char *erase[] = { /* backspace-space-backspace */ | 744 | static char *erase[] = { /* backspace-space-backspace */ |
754 | "\010\040\010", /* space parity */ | 745 | "\010\040\010", /* space parity */ |
755 | "\010\040\010", /* odd parity */ | 746 | "\010\040\010", /* odd parity */ |
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c index a458b6ed7..4e689ad68 100644 --- a/loginutils/sulogin.c +++ b/loginutils/sulogin.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #define SULOGIN_PROMPT "\nGive root password for system maintenance\n" \ | 21 | #define SULOGIN_PROMPT "\nGive root password for system maintenance\n" \ |
22 | "(or type Control-D for normal startup):" | 22 | "(or type Control-D for normal startup):" |
23 | 23 | ||
24 | static const char *forbid[] = { | 24 | static const char * const forbid[] = { |
25 | "ENV", | 25 | "ENV", |
26 | "BASH_ENV", | 26 | "BASH_ENV", |
27 | "HOME", | 27 | "HOME", |
@@ -53,11 +53,13 @@ extern int sulogin_main(int argc, char **argv) | |||
53 | char *device = (char *) 0; | 53 | char *device = (char *) 0; |
54 | const char *name = "root"; | 54 | const char *name = "root"; |
55 | int timeout = 0; | 55 | int timeout = 0; |
56 | static char pass[BUFSIZ]; | 56 | |
57 | #define pass bb_common_bufsiz1 | ||
58 | |||
57 | struct passwd pwent; | 59 | struct passwd pwent; |
58 | struct passwd *pwd; | 60 | struct passwd *pwd; |
59 | time_t start, now; | 61 | time_t start, now; |
60 | const char **p; | 62 | const char * const *p; |
61 | #ifdef CONFIG_FEATURE_SHADOWPASSWDS | 63 | #ifdef CONFIG_FEATURE_SHADOWPASSWDS |
62 | struct spwd *spwd = NULL; | 64 | struct spwd *spwd = NULL; |
63 | #endif /* CONFIG_FEATURE_SHADOWPASSWDS */ | 65 | #endif /* CONFIG_FEATURE_SHADOWPASSWDS */ |
diff --git a/networking/nc.c b/networking/nc.c index 8f641ae4f..fda1fb8f6 100644 --- a/networking/nc.c +++ b/networking/nc.c | |||
@@ -48,7 +48,9 @@ static void timeout(int signum) | |||
48 | int nc_main(int argc, char **argv) | 48 | int nc_main(int argc, char **argv) |
49 | { | 49 | { |
50 | int do_listen = 0, lport = 0, delay = 0, wsecs = 0, tmpfd, opt, sfd, x; | 50 | int do_listen = 0, lport = 0, delay = 0, wsecs = 0, tmpfd, opt, sfd, x; |
51 | char buf[BUFSIZ]; | 51 | |
52 | #define buf bb_common_bufsiz1 | ||
53 | |||
52 | #ifdef CONFIG_NC_GAPING_SECURITY_HOLE | 54 | #ifdef CONFIG_NC_GAPING_SECURITY_HOLE |
53 | char *pr00gie = NULL; | 55 | char *pr00gie = NULL; |
54 | #endif | 56 | #endif |
diff --git a/shell/ash.c b/shell/ash.c index 559238c3f..6edc48421 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -568,7 +568,7 @@ struct parsefile { | |||
568 | }; | 568 | }; |
569 | 569 | ||
570 | static struct parsefile basepf; /* top level input file */ | 570 | static struct parsefile basepf; /* top level input file */ |
571 | static char basebuf[IBUFSIZ]; /* buffer for top level input file */ | 571 | #define basebuf bb_common_bufsiz1 /* buffer for top level input file */ |
572 | static struct parsefile *parsefile = &basepf; /* current input file */ | 572 | static struct parsefile *parsefile = &basepf; /* current input file */ |
573 | 573 | ||
574 | 574 | ||
@@ -5939,7 +5939,6 @@ varunset(const char *end, const char *var, const char *umsg, int varflags) | |||
5939 | */ | 5939 | */ |
5940 | 5940 | ||
5941 | #define EOF_NLEFT -99 /* value of parsenleft when EOF pushed back */ | 5941 | #define EOF_NLEFT -99 /* value of parsenleft when EOF pushed back */ |
5942 | #define IBUFSIZ (BUFSIZ + 1) | ||
5943 | 5942 | ||
5944 | static void pushfile(void); | 5943 | static void pushfile(void); |
5945 | 5944 | ||