From b20be7cbad775ec2119e022ed8e4d225a488c90c Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Sun, 16 Feb 2020 23:05:43 -0500 Subject: Various small cleanups Haven't really gone through ui.c yet. --- url.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'url.c') diff --git a/url.c b/url.c index 64fdd8b..949f860 100644 --- a/url.c +++ b/url.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -142,8 +143,10 @@ static void urlCopy(const char *url) { int error = pipe(rw); if (error) err(EX_OSERR, "pipe"); - ssize_t len = write(rw[1], url, strlen(url)); - if (len < 0) err(EX_IOERR, "write"); + size_t len = strlen(url); + if (len > PIPE_BUF) len = PIPE_BUF; + ssize_t n = write(rw[1], url, len); + if (n < 0) err(EX_IOERR, "write"); error = close(rw[1]); if (error) err(EX_IOERR, "close"); -- cgit 1.4.1-2-gfad0