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/cvs/diff_internals.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/cvs/diff_internals.c')
-rw-r--r-- | usr.bin/cvs/diff_internals.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/usr.bin/cvs/diff_internals.c b/usr.bin/cvs/diff_internals.c index 0eaf95039ec..aa072bfb5e2 100644 --- a/usr.bin/cvs/diff_internals.c +++ b/usr.bin/cvs/diff_internals.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff_internals.c,v 1.29 2010/07/15 11:10:23 ray Exp $ */ +/* $OpenBSD: diff_internals.c,v 1.30 2010/07/15 18:23:50 ray Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -859,11 +859,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) { - cvs_log(LP_ERR, "preadline failed"); - xfree(line); - return (NULL); - } + if ((nr = pread(fd, line, rlen, off)) < 0) + fatal("preadline: %s", strerror(errno)); line[nr] = '\0'; return (line); } |