[hackers] [utmp] Pass name of shell as first parameter of child process || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sun, 10 Aug 2014 21:24:42 +0200

commit c282965520a0d8bcc2b8c2f010fd96ad063a25c3
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Thu Aug 7 14:31:08 2014 +0200

    Pass name of shell as first parameter of child process
    
    This is important because this is the value that is usually
    shown by ps (and it is also used by some windows managers to
    display who is running).

diff --git a/utmp.c b/utmp.c
index 6ab5289..c893ae1 100644
--- a/utmp.c
+++ b/utmp.c
_AT_@ -56,7 +56,8 @@ main(int argc, char *argv[])
 
         switch (fork()) {
         case 0:
- execv(getenv("SHELL"), ++argv);
+ argv[0] = getenv("SHELL");
+ execv(argv[0], argv);
                 die("error executing shell:%s", strerror(errno));
         case -1:
                 die("error spawning child:%s", strerror(errno));
Received on Sun Aug 10 2014 - 21:24:42 CEST

This archive was generated by hypermail 2.3.0 : Sun Aug 10 2014 - 21:36:08 CEST