ubase

suckless linux base utils
git clone git://git.2f30.org/ubase
Log | Files | Refs | README | LICENSE

commit a6263b656ee1c0ce0f8d28c010caa84b81e60663
parent d7ef6ea895a18133e6b296032de37226fceb6a66
Author: sin <sin@2f30.org>
Date:   Mon, 24 Feb 2014 12:26:40 +0000

Use setenv() instead of putenv() in getty

Diffstat:
Mgetty.c | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/getty.c b/getty.c @@ -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[]) @@ -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; @@ -49,7 +47,7 @@ main(int argc, char *argv[]) sigemptyset(&sa.sa_mask); sigaction(SIGHUP, &sa, NULL); - putenv(term); + setenv("TERM", term, 1); setsid();