summaryrefslogtreecommitdiff
path: root/usr.bin/less
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 05:44:10 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 05:44:10 +0000
commit596d9c453238ef5e80f2b7f5f414b4aedcbca5cb (patch)
tree7e2ba7c8473ad2e261264fc72b75d91034862585 /usr.bin/less
parentdb251f9c53ebe82df0e02b3d742581fd8b421989 (diff)
asprintf returns -1, not an arbitrary value < 0. Also upon error the
(very sloppy specification) leaves an undefined value in *ret, so it is wrong to inspect it, the error condition is enough. discussed a little with nicm, and then much more with millert until we were exasperated
Diffstat (limited to 'usr.bin/less')
-rw-r--r--usr.bin/less/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/less/main.c b/usr.bin/less/main.c
index 5fc7f131803..9820eb5903f 100644
--- a/usr.bin/less/main.c
+++ b/usr.bin/less/main.c
@@ -303,7 +303,7 @@ easprintf(const char *fmt, ...)
rv = vasprintf(&p, fmt, ap);
va_end(ap);
- if (p == NULL || rv < 0) {
+ if (rv == -1) {
error("Cannot allocate memory", NULL);
quit(QUIT_ERROR);
}