s/geteuid/getuid/ for correct user lookups

Addresses an issue mentioned in #193.
This commit is contained in:
John Hood
2016-11-23 17:03:21 -05:00
parent 8fcfb3a587
commit bb54325dc9
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -124,7 +124,7 @@ int main( int argc, char *argv[] )
/* get shell name */ /* get shell name */
my_argv[ 0 ] = getenv( "SHELL" ); my_argv[ 0 ] = getenv( "SHELL" );
if ( my_argv[ 0 ] == NULL || *my_argv[ 0 ] == '\0' ) { if ( my_argv[ 0 ] == NULL || *my_argv[ 0 ] == '\0' ) {
struct passwd *pw = getpwuid( geteuid() ); struct passwd *pw = getpwuid( getuid() );
if ( pw == NULL ) { if ( pw == NULL ) {
perror( "getpwuid" ); perror( "getpwuid" );
exit( 1 ); exit( 1 );
+3 -3
View File
@@ -282,7 +282,7 @@ int main( int argc, char *argv[] )
/* get shell name */ /* get shell name */
const char *shell = getenv( "SHELL" ); const char *shell = getenv( "SHELL" );
if ( shell == NULL ) { if ( shell == NULL ) {
struct passwd *pw = getpwuid( geteuid() ); struct passwd *pw = getpwuid( getuid() );
if ( pw == NULL ) { if ( pw == NULL ) {
perror( "getpwuid" ); perror( "getpwuid" );
exit( 1 ); exit( 1 );
@@ -906,7 +906,7 @@ static void chdir_homedir( void )
{ {
const char *home = getenv( "HOME" ); const char *home = getenv( "HOME" );
if ( home == NULL ) { if ( home == NULL ) {
struct passwd *pw = getpwuid( geteuid() ); struct passwd *pw = getpwuid( getuid() );
if ( pw == NULL ) { if ( pw == NULL ) {
perror( "getpwuid" ); perror( "getpwuid" );
return; /* non-fatal */ return; /* non-fatal */
@@ -941,7 +941,7 @@ static void warn_unattached( const string & ignore_entry )
{ {
#ifdef HAVE_UTMPX_H #ifdef HAVE_UTMPX_H
/* get username */ /* get username */
const struct passwd *pw = getpwuid( geteuid() ); const struct passwd *pw = getpwuid( getuid() );
if ( pw == NULL ) { if ( pw == NULL ) {
perror( "getpwuid" ); perror( "getpwuid" );
/* non-fatal */ /* non-fatal */