diff options
author | C. McEnroe | 2020-02-16 23:05:43 -0500 |
---|---|---|
committer | C. McEnroe | 2020-02-16 23:05:43 -0500 |
commit | b20be7cbad775ec2119e022ed8e4d225a488c90c (patch) | |
tree | caba6234d7027c5d2090f6482c23f5411abef3eb /url.c | |
parent | ba524ed8045ea0e14664a64790fee53dd72a4541 (diff) |
Various small cleanups
Haven't really gone through ui.c yet.
Diffstat (limited to 'url.c')
-rw-r--r-- | url.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/url.c b/url.c index 64fdd8b..949f860 100644 --- a/url.c +++ b/url.c @@ -17,6 +17,7 @@ #include <assert.h> #include <err.h> #include <errno.h> +#include <limits.h> #include <regex.h> #include <stdio.h> #include <stdlib.h> @@ -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"); |