summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpedro <pedro@openbsd.org>2006-05-27 18:06:29 +0000
committerpedro <pedro@openbsd.org>2006-05-27 18:06:29 +0000
commit844c16431ffc3bd5f5eaf5ba8263d68969bfea00 (patch)
tree03f723eb0e8224614e9ec6d057215d6a6a41efad
parentbasic support for CVSROOT/config - only supporting the 'tag' and (diff)
downloadwireguard-openbsd-844c16431ffc3bd5f5eaf5ba8263d68969bfea00.tar.xz
wireguard-openbsd-844c16431ffc3bd5f5eaf5ba8263d68969bfea00.zip
System calls return -1 upon failure, so check for -1
Pointed out by deraadt@
-rw-r--r--lib/libc/gen/getcwd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/gen/getcwd.c b/lib/libc/gen/getcwd.c
index 6b4efeacc0c..82bd19e26a4 100644
--- a/lib/libc/gen/getcwd.c
+++ b/lib/libc/gen/getcwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getcwd.c,v 1.16 2006/05/27 18:00:27 pedro Exp $ */
+/* $OpenBSD: getcwd.c,v 1.17 2006/05/27 18:06:29 pedro Exp $ */
/*
* Copyright (c) 2005 Marius Eriksen <marius@openbsd.org>
@@ -36,7 +36,7 @@ getcwd(char *buf, size_t size)
(allocated = buf = malloc(size = MAXPATHLEN)) == NULL)
return (NULL);
- if (__getcwd(buf, size) < 0) {
+ if (__getcwd(buf, size) == -1) {
free(allocated);
return (NULL);
}