*: hopefully all setup_common_bufsiz() are in place
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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
|
||||
) {
|
||||
|
@@ -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) {
|
||||
|
@@ -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);
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user