From 0a0cd1396a0572dd1f04e8fdd99f682e4e4f91ee Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 Jan 2009 09:04:30 +0100 Subject: s3:smbd: remove pointless static variable in uid.c We always free the value at the end of the function, so we don't need a static variable to hold just NULL for the time the function isn't executed. metze --- source3/smbd/uid.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index 5a4b8a52e7..82204e97e9 100644 --- a/source3/smbd/uid.c +++ b/source3/smbd/uid.c @@ -28,13 +28,11 @@ extern struct current_user current_user; bool change_to_guest(void) { - static struct passwd *pass=NULL; + struct passwd *pass; + pass = getpwnam_alloc(talloc_autofree_context(), lp_guestaccount()); if (!pass) { - /* Don't need to free() this as its stored in a static */ - pass = getpwnam_alloc(talloc_autofree_context(), lp_guestaccount()); - if (!pass) - return(False); + return false; } #ifdef AIX @@ -49,9 +47,8 @@ bool change_to_guest(void) current_user.vuid = UID_FIELD_INVALID; TALLOC_FREE(pass); - pass = NULL; - return True; + return true; } /******************************************************************* -- cgit