[hackers] [ubase] Use setenv() instead of putenv() in getty || sin

From: <git_AT_suckless.org>
Date: Mon, 24 Feb 2014 14:00:43 +0100

commit a6263b656ee1c0ce0f8d28c010caa84b81e60663
Author: sin <sin_AT_2f30.org>
Date: Mon Feb 24 12:26:40 2014 +0000

    Use setenv() instead of putenv() in getty

diff --git a/getty.c b/getty.c
index d9c7902..73f918d 100644
--- a/getty.c
+++ b/getty.c
_AT_@ -18,7 +18,7 @@ usage(void)
 }
 
 static char *tty = "/dev/tty1";
-static char *defaultterm = "TERM=linux";
+static char *defaultterm = "linux";
 
 int
 main(int argc, char *argv[])
_AT_@ -38,10 +38,8 @@ main(int argc, char *argv[])
         strlcpy(term, defaultterm, sizeof(term));
         if (argc > 0) {
                 tty = argv[0];
- if (argc > 1) {
- strlcpy(term, "TERM=", sizeof(term));
- strlcat(term, argv[1], sizeof(term));
- }
+ if (argc > 1)
+ strlcpy(term, argv[1], sizeof(term));
         }
 
         sa.sa_handler = SIG_IGN;
_AT_@ -49,7 +47,7 @@ main(int argc, char *argv[])
         sigemptyset(&sa.sa_mask);
         sigaction(SIGHUP, &sa, NULL);
 
- putenv(term);
+ setenv("TERM", term, 1);
 
         setsid();
 
Received on Mon Feb 24 2014 - 14:00:43 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 24 2014 - 14:12:17 CET