summaryrefslogtreecommitdiff
path: root/usr.bin/file
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/file
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/file')
-rw-r--r--usr.bin/file/xmalloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/file/xmalloc.c b/usr.bin/file/xmalloc.c
index 5c145045476..c05b08fedbe 100644
--- a/usr.bin/file/xmalloc.c
+++ b/usr.bin/file/xmalloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xmalloc.c,v 1.3 2015/11/17 18:25:03 tobias Exp $ */
+/* $OpenBSD: xmalloc.c,v 1.4 2019/06/28 05:44:09 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -80,7 +80,7 @@ xasprintf(char **ret, const char *fmt, ...)
i = vasprintf(ret, fmt, ap);
va_end(ap);
- if (i < 0 || *ret == NULL)
+ if (i == -1)
err(1, "xasprintf");
return i;