URI:
       Change name of pass structure - utmp - simple login manager  
  HTML git clone git://git.suckless.org/utmp
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 5ac5ede22b55ec5820dbacf1c5e5e9d9c2b2d9ad
   DIR parent 35bb808dbe01cba4f48f0a57fc76050c8d522fab
  HTML Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
       Date:   Thu, 28 Aug 2014 11:37:41 +0200
       
       Change name of pass structure
       
       It is idiomatic the use of the simple pw instead of pass for
       variables of type struct pass.
       
       Diffstat:
         M bsd.c                               |       8 ++++----
         M posix.c                             |       8 ++++----
         M utmp.c                              |      14 +++++++-------
       
       3 files changed, 15 insertions(+), 15 deletions(-)
       ---
   DIR diff --git a/bsd.c b/bsd.c
       @@ -11,7 +11,7 @@
        #include <pwd.h>
        
        extern void die(const char *fmt, ...);
       -extern struct passwd *pass;
       +extern struct passwd *pw;
        extern gid_t egid, gid;
        static struct utmp utmp;
        
       @@ -25,8 +25,8 @@ addutmp(void)
                if (!(host = getenv("DISPLAY")))
                        host = "-";
        
       -        if (strlen(pass->pw_name) > sizeof(utmp.ut_name))
       -                die("incorrect username %s", pass->pw_name);
       +        if (strlen(pw->pw_name) > sizeof(utmp.ut_name))
       +                die("incorrect username %s", pw->pw_name);
        
                if ((pts = ttyname(STDIN_FILENO)) == NULL)
                        die("error getting pty name:%s", strerror(errno));
       @@ -40,7 +40,7 @@ addutmp(void)
        
                /* remove /dev/ from pts */
                strncpy(utmp.ut_line, pts + 5, sizeof(utmp.ut_line));
       -        strncpy(utmp.ut_name, pass->pw_name, sizeof(utmp.ut_name));
       +        strncpy(utmp.ut_name, pw->pw_name, sizeof(utmp.ut_name));
                strncpy(utmp.ut_host, host, sizeof(utmp.ut_host));
                time(&utmp.ut_time);
        
   DIR diff --git a/posix.c b/posix.c
       @@ -29,7 +29,7 @@
        
        extern void die(const char *fmt, ...);
        static struct utmpx utmp;
       -extern struct passwd *pass;
       +extern struct passwd *pw;
        extern gid_t egid, gid;
        
        
       @@ -70,8 +70,8 @@ addutmp(void)
                unsigned ptyid;
                char *pts, *cp, buf[5] = {'x'};
        
       -        if (strlen(pass->pw_name) > sizeof(utmp.ut_user))
       -                die("incorrect username %s", pass->pw_name);
       +        if (strlen(pw->pw_name) > sizeof(utmp.ut_user))
       +                die("incorrect username %s", pw->pw_name);
        
                if ((pts = ttyname(STDIN_FILENO)) == NULL)
                        die("error getting pty name\n");
       @@ -92,7 +92,7 @@ addutmp(void)
                        findutmp(USER_PROCESS);
        
                utmp.ut_type = USER_PROCESS;
       -        strncpy(utmp.ut_user, pass->pw_name, sizeof(utmp.ut_user));
       +        strncpy(utmp.ut_user, pw->pw_name, sizeof(utmp.ut_user));
                utmp.ut_pid = getpid();
                utmp.ut_tv.tv_sec = time(NULL);
                utmp.ut_tv.tv_usec = 0;
   DIR diff --git a/utmp.c b/utmp.c
       @@ -19,7 +19,7 @@
        #endif
        
        
       -struct passwd *pass;
       +struct passwd *pw;
        gid_t egid, gid;
        
        
       @@ -46,14 +46,14 @@ main(int argc, char *argv[])
                gid = getgid();
                setgid(gid);
        
       -        pass = getpwuid(uid = getuid());
       -        if (!pass || !pass->pw_name)
       +        pw = getpwuid(uid = getuid());
       +        if (!pw || !pw->pw_name)
                        die("Process is running with an incorrect uid %d", uid);
        
       -        setenv("LOGNAME", pass->pw_name, 1);
       -        setenv("USER", pass->pw_name, 1);
       -        setenv("SHELL", pass->pw_shell, 0);
       -        setenv("HOME", pass->pw_dir, 0);
       +        setenv("LOGNAME", pw->pw_name, 1);
       +        setenv("USER", pw->pw_name, 1);
       +        setenv("SHELL", pw->pw_shell, 1);
       +        setenv("HOME", pw->pw_dir, 1);
        
                sigfillset(&set);
                sigprocmask(SIG_BLOCK, &set, NULL);