aboutsummaryrefslogtreecommitdiff
path: root/libbb/read_printf.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@tigress.co.uk>2015-04-19 10:50:25 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2015-04-20 13:41:32 +0200
commit61d6ae244af424b2a05468307723f21c8810ab9e (patch)
treeff29ec2307a60d1b8d4f110396042a6ec0a43274 /libbb/read_printf.c
parentad795510d9fd6f4290be170c84c0d30eb1af7245 (diff)
downloadbusybox-w32-61d6ae244af424b2a05468307723f21c8810ab9e.tar.gz
busybox-w32-61d6ae244af424b2a05468307723f21c8810ab9e.tar.bz2
busybox-w32-61d6ae244af424b2a05468307723f21c8810ab9e.zip
libbb: remove unnecessary argument to nonblock_immune_read
The loop_on_EINTR argument to nonblock_immune_read is always set to 1. function old new delta xmalloc_reads 200 195 -5 pgetc 488 483 -5 argstr 1313 1308 -5 nonblock_immune_read 123 86 -37 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-52) Total: -52 bytes Signed-off-by: Ron Yorston <rmy@tigress.co.uk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/read_printf.c')
-rw-r--r--libbb/read_printf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libbb/read_printf.c b/libbb/read_printf.c
index 5ed6e3632..b6a17cc36 100644
--- a/libbb/read_printf.c
+++ b/libbb/read_printf.c
@@ -45,20 +45,20 @@
45 * which detects EAGAIN and uses poll() to wait on the fd. 45 * which detects EAGAIN and uses poll() to wait on the fd.
46 * Thankfully, poll() doesn't care about O_NONBLOCK flag. 46 * Thankfully, poll() doesn't care about O_NONBLOCK flag.
47 */ 47 */
48ssize_t FAST_FUNC nonblock_immune_read(int fd, void *buf, size_t count, int loop_on_EINTR) 48ssize_t FAST_FUNC nonblock_immune_read(int fd, void *buf, size_t count)
49{ 49{
50 struct pollfd pfd[1]; 50 struct pollfd pfd[1];
51 ssize_t n; 51 ssize_t n;
52 52
53 while (1) { 53 while (1) {
54 n = loop_on_EINTR ? safe_read(fd, buf, count) : read(fd, buf, count); 54 n = safe_read(fd, buf, count);
55 if (n >= 0 || errno != EAGAIN) 55 if (n >= 0 || errno != EAGAIN)
56 return n; 56 return n;
57 /* fd is in O_NONBLOCK mode. Wait using poll and repeat */ 57 /* fd is in O_NONBLOCK mode. Wait using poll and repeat */
58 pfd[0].fd = fd; 58 pfd[0].fd = fd;
59 pfd[0].events = POLLIN; 59 pfd[0].events = POLLIN;
60 /* note: safe_poll pulls in printf */ 60 /* note: safe_poll pulls in printf */
61 loop_on_EINTR ? safe_poll(pfd, 1, -1) : poll(pfd, 1, -1); 61 safe_poll(pfd, 1, -1);
62 } 62 }
63} 63}
64 64
@@ -81,7 +81,7 @@ char* FAST_FUNC xmalloc_reads(int fd, size_t *maxsz_p)
81 p = buf + sz; 81 p = buf + sz;
82 sz += 128; 82 sz += 128;
83 } 83 }
84 if (nonblock_immune_read(fd, p, 1, /*loop_on_EINTR:*/ 1) != 1) { 84 if (nonblock_immune_read(fd, p, 1) != 1) {
85 /* EOF/error */ 85 /* EOF/error */
86 if (p == buf) { /* we read nothing */ 86 if (p == buf) { /* we read nothing */
87 free(buf); 87 free(buf);