SHELL must be set to the SHELL of the user, but it was possible set
it to utmp.
+       char **args, *sh, *prog;
        const struct passwd *pw;
        char buf[sizeof(long) * 8 + 1];
 
        const struct passwd *pw;
        char buf[sizeof(long) * 8 + 1];
 
 
-       if (utmp)
-               sh = utmp;
-       else if (pw->pw_shell[0])
-               sh = pw->pw_shell;
+       sh = (pw->pw_shell[0]) ? pw->pw_shell : shell;
+       if(opt_cmd)
+               prog = opt_cmd[0];
+       else if(utmp)
+               prog = utmp;
-               sh = shell;
-       args = (opt_cmd) ? opt_cmd : (char *[]){sh, NULL};
+               prog = sh;
+       args = (opt_cmd) ? opt_cmd : (char *[]) {prog, NULL};
+
        snprintf(buf, sizeof(buf), "%lu", xw.win);
 
        unsetenv("COLUMNS");
        snprintf(buf, sizeof(buf), "%lu", xw.win);
 
        unsetenv("COLUMNS");
 
        unsetenv("TERMCAP");
        setenv("LOGNAME", pw->pw_name, 1);
        setenv("USER", pw->pw_name, 1);
        unsetenv("TERMCAP");
        setenv("LOGNAME", pw->pw_name, 1);
        setenv("USER", pw->pw_name, 1);
-       setenv("SHELL", args[0], 1);
+       setenv("SHELL", sh, 1);
        setenv("HOME", pw->pw_dir, 1);
        setenv("TERM", termname, 1);
        setenv("WINDOWID", buf, 1);
        setenv("HOME", pw->pw_dir, 1);
        setenv("TERM", termname, 1);
        setenv("WINDOWID", buf, 1);
 
        signal(SIGTERM, SIG_DFL);
        signal(SIGALRM, SIG_DFL);
 
        signal(SIGTERM, SIG_DFL);
        signal(SIGALRM, SIG_DFL);