Call getspnam() only iff needed.
Jarkko Hietaniemi [Tue, 2 May 2000 17:41:24 +0000 (17:41 +0000)]
p4raw-id: //depot/cfgperl@6047

pp_sys.c

index 765b0bc..2f67483 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -4793,11 +4793,6 @@ PP(pp_gpwent)
        break;
     }
 
-#   ifdef HAS_GETSPNAM
-    if (GIMME != G_ARRAY && pwent)
-       spwent = getspnam(pwent->pw_name);
-#   endif
-
     EXTEND(SP, 10);
     if (GIMME != G_ARRAY) {
        PUSHs(sv = sv_newmortal());
@@ -4820,12 +4815,13 @@ PP(pp_gpwent)
 
        PUSHs(sv = sv_mortalcopy(&PL_sv_no));
 #   ifdef HAS_GETSPNAM
-      if (spwent)
-         sv_setpv(sv, spwent->sp_pwdp);
-      else
-         sv_setpv(sv, pwent->pw_passwd);
+       spwent = getspnam(pwent->pw_name);
+       if (spwent)
+           sv_setpv(sv, spwent->sp_pwdp);
+       else
+           sv_setpv(sv, pwent->pw_passwd);
 #   else
-      sv_setpv(sv, pwent->pw_passwd);
+       sv_setpv(sv, pwent->pw_passwd);
 #   endif
 #   ifndef INCOMPLETE_TAINTS
        /* passwd is tainted because user himself can diddle with it. */