summaryrefslogtreecommitdiff
path: root/usr.bin/vi/ex
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2000-09-15 07:13:52 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2000-09-15 07:13:52 +0000
commit42a3e69c05af72afbc1d37574fba7729b828289b (patch)
treebecf08be7a11e201542de4de93b8cd0f8650f9e1 /usr.bin/vi/ex
parentb74ef7bac5077f29fc1c12e8b5ccaf0e2f1f8fdc (diff)
check return value for setenv(3) for failure, and deal appropriately
Diffstat (limited to 'usr.bin/vi/ex')
-rw-r--r--usr.bin/vi/ex/ex_script.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/vi/ex/ex_script.c b/usr.bin/vi/ex/ex_script.c
index 9ca6d60060d..8a7cb472e4c 100644
--- a/usr.bin/vi/ex/ex_script.c
+++ b/usr.bin/vi/ex/ex_script.c
@@ -156,9 +156,10 @@ err: if (sc->sh_master != -1)
* XXX
* So that shells that do command line editing turn it off.
*/
- (void)setenv("TERM", "emacs", 1);
- (void)setenv("TERMCAP", "emacs:", 1);
- (void)setenv("EMACS", "t", 1);
+ if (setenv("TERM", "emacs", 1) == -1 ||
+ setenv("TERMCAP", "emacs:", 1) == -1 ||
+ setenv("EMACS", "t", 1) == -1)
+ _exit(126);
(void)setsid();
#ifdef TIOCSCTTY