* src/login.c: Added parameter to check_nologin. This will help

getting rid of the global pwent variable.
This commit is contained in:
nekral-guest 2009-04-20 12:33:01 +00:00
parent 61c1d100dc
commit 70e1a5c9b6
2 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2009-04-20 Nicolas François <nicolas.francois@centraliens.net>
* src/login.c: Added parameter to check_nologin. This will help
getting rid of the global pwent variable.
2009-04-20 Nicolas François <nicolas.francois@centraliens.net> 2009-04-20 Nicolas François <nicolas.francois@centraliens.net>
* src/login.c: Added comments. * src/login.c: Added comments.

View File

@ -134,7 +134,7 @@ static void process_flags (int, char *const *);
static struct faillog faillog; static struct faillog faillog;
static void bad_time_notify (void); static void bad_time_notify (void);
static void check_nologin (void); static void check_nologin (bool login_to_root);
#endif #endif
static void init_env (void); static void init_env (void);
@ -205,7 +205,7 @@ static void bad_time_notify (void)
(void) fflush (stdout); (void) fflush (stdout);
} }
static void check_nologin (void) static void check_nologin (bool login_to_root)
{ {
char *fname; char *fname;
@ -244,7 +244,7 @@ static void check_nologin (void)
* gets to login. * gets to login.
*/ */
if (pwent.pw_uid != 0) { if (!login_to_root) {
closelog (); closelog ();
exit (0); exit (0);
} }
@ -1064,7 +1064,7 @@ int main (int argc, char **argv)
exit (1); exit (1);
} }
check_nologin (); check_nologin (pwent.pw_uid == 0);
#endif #endif
if (getenv ("IFS")) { /* don't export user IFS ... */ if (getenv ("IFS")) { /* don't export user IFS ... */