Add forgotten part of setenv cleanup
authorSimon Schubert <corecode@dragonflybsd.org>
Tue, 17 Jan 2006 15:06:26 +0000 (15:06 +0000)
committerSimon Schubert <corecode@dragonflybsd.org>
Tue, 17 Jan 2006 15:06:26 +0000 (15:06 +0000)
Submitted-by: Alexey Slynko <slynko@tronet.ru>
bin/sh/histedit.c

index bb15124..5fa910f 100644 (file)
@@ -35,7 +35,7 @@
  *
  * @(#)histedit.c      8.2 (Berkeley) 5/4/95
  * $FreeBSD: src/bin/sh/histedit.c,v 1.13.2.4 2002/08/27 01:36:28 tjr Exp $
- * $DragonFly: src/bin/sh/histedit.c,v 1.6 2005/11/13 11:58:30 corecode Exp $
+ * $DragonFly: src/bin/sh/histedit.c,v 1.7 2006/01/17 15:06:26 corecode Exp $
  */
 
 #include <sys/param.h>
@@ -110,8 +110,10 @@ histedit(void)
                                goto bad;
                        el_err = el_out;
                        term = lookupvar("TERM");
-                       if (term)
-                               setenv("TERM", term, 1);
+                       if (term) {
+                               if (setenv("TERM", term, 1) == -1)
+                                       error("setenv: cannot set TERM=1");
+                       }
                        else
                                unsetenv("TERM");
                        shname = arg0;