diff options
author | 2010-07-15 18:23:50 +0000 | |
---|---|---|
committer | 2010-07-15 18:23:50 +0000 | |
commit | 7a6efebc84ac15fc4b596886b91780ea44e8d79c (patch) | |
tree | f1ccb6015cad87cfb01bc852dafe236de5cfa92c /usr.bin/rcs/diff.c | |
parent | Use warnx instead of warn since errno wasn't set. From diff. (diff) | |
download | wireguard-openbsd-7a6efebc84ac15fc4b596886b91780ea44e8d79c.tar.xz wireguard-openbsd-7a6efebc84ac15fc4b596886b91780ea44e8d79c.zip |
Die immediately if pread fails. It's a fatal error so treat it as
such. Besides, we weren't handling the NULL being returned.
From diff. Minor nit by nicm.
OK xsa stsp nicm
Diffstat (limited to 'usr.bin/rcs/diff.c')
-rw-r--r-- | usr.bin/rcs/diff.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/usr.bin/rcs/diff.c b/usr.bin/rcs/diff.c index 7c5383ddbdc..4b806bb5d00 100644 --- a/usr.bin/rcs/diff.c +++ b/usr.bin/rcs/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.28 2010/07/15 18:19:18 ray Exp $ */ +/* $OpenBSD: diff.c,v 1.29 2010/07/15 18:23:50 ray Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -842,11 +842,8 @@ preadline(int fd, size_t rlen, off_t off) ssize_t nr; line = xmalloc(rlen + 1); - if ((nr = pread(fd, line, rlen, off)) < 0) { - warn("preadline failed"); - xfree(line); - return (NULL); - } + if ((nr = pread(fd, line, rlen, off)) < 0) + err(D_ERROR, "preadline"); line[nr] = '\0'; return (line); } |