diff options
author | Steven Mestdagh <steven@cvs.openbsd.org> | 2007-02-26 08:32:01 +0000 |
---|---|---|
committer | Steven Mestdagh <steven@cvs.openbsd.org> | 2007-02-26 08:32:01 +0000 |
commit | ffaaad5141d470af3ee6ce63493c04ab7e72f44e (patch) | |
tree | 220e91f52d4f7d20e8a9f6ed29783ef6434b614f /usr.bin | |
parent | be002226b7ec2a7cbff8f5c9318106a731279671 (diff) |
don't store write(2) return value in size_t; fixes test against -1.
ok ray@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/sdiff/edit.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/sdiff/edit.c b/usr.bin/sdiff/edit.c index 3a9c03c69ac..d82f90cb8f5 100644 --- a/usr.bin/sdiff/edit.c +++ b/usr.bin/sdiff/edit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: edit.c,v 1.14 2006/05/25 03:20:32 ray Exp $ */ +/* $OpenBSD: edit.c,v 1.15 2007/02/26 08:32:00 steven Exp $ */ /* * Written by Raymond Lai <ray@cyth.net>. @@ -69,7 +69,7 @@ int eparse(const char *cmd, const char *left, const char *right) { FILE *file; - size_t nread, nwritten; + size_t nread; int fd; char *filename; char buf[BUFSIZ], *text; @@ -129,6 +129,7 @@ RIGHT: err(2, "mkstemp"); if (text != NULL) { size_t len; + ssize_t nwritten; len = strlen(text); if ((nwritten = write(fd, text, len)) == -1 || @@ -153,6 +154,8 @@ RIGHT: /* Copy temporary file contents to output file. */ for (nread = sizeof(buf); nread == sizeof(buf);) { + size_t nwritten; + nread = fread(buf, sizeof(*buf), sizeof(buf), file); /* Test for error or end of file. */ if (nread != sizeof(buf) && |