summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/error.c
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2000-10-13 08:29:20 +0000
committerespie <espie@openbsd.org>2000-10-13 08:29:20 +0000
commitac3def53bdced96c45b6ebcabc97cf341bbd4914 (patch)
tree3f6505af6956b4f07fb45073e5a7eea6637e590e /usr.bin/make/error.c
parentClean up static constructor/destructor discovery and calling. Instead (diff)
downloadwireguard-openbsd-ac3def53bdced96c45b6ebcabc97cf341bbd4914.tar.xz
wireguard-openbsd-ac3def53bdced96c45b6ebcabc97cf341bbd4914.zip
esetenv: does a setenv and bails out if error.
Diffstat (limited to 'usr.bin/make/error.c')
-rw-r--r--usr.bin/make/error.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/usr.bin/make/error.c b/usr.bin/make/error.c
index 03fb423a632..e6902228938 100644
--- a/usr.bin/make/error.c
+++ b/usr.bin/make/error.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: error.c,v 1.3 2000/06/23 16:27:29 espie Exp $ */
+/* $OpenBSD: error.c,v 1.4 2000/10/13 08:29:20 espie Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -142,9 +142,23 @@ void
enomem(size)
size_t size;
{
- int myerr = errno;
+ fprintf(stderr, "make: %s (%lu)\n", strerror(errno), (u_long)size);
+ exit(2);
+}
+
+/*
+ * esetenv --
+ * change environment, die on error.
+ */
+void
+esetenv(name, value)
+ const char *name;
+ const char *value;
+{
+ if (setenv(name, value, 1) == 0)
+ return;
- fprintf(stderr, "make: %s (%lu)\n", strerror(myerr), (u_long)size);
+ fprintf(stderr, "make: setenv failed (%s)\n", strerror(errno));
exit(2);
}