From: Stefan Metzmacher Date: Thu, 8 Jan 2009 08:04:30 +0000 (+0100) Subject: s3:smbd: remove pointless static variable in uid.c X-Git-Tag: samba-4.0.0alpha6~221^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0a0cd1396a0572dd1f04e8fdd99f682e4e4f91ee;p=thirdparty%2Fsamba.git 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 --- diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index 5a4b8a52e79..82204e97e97 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; } /*******************************************************************