[PATCH] Remove unnecessary strdup.

Jim Meyering meyering at redhat.com
Tue Mar 4 02:14:10 PST 2008


* src/polkit-grant/polkit-grant-helper-shadow.c (do_auth):

Signed-off-by: Jim Meyering <meyering at redhat.com>
---
 src/polkit-grant/polkit-grant-helper-shadow.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/src/polkit-grant/polkit-grant-helper-shadow.c b/src/polkit-grant/polkit-grant-helper-shadow.c
index 018e30a..9586c5f 100644
--- a/src/polkit-grant/polkit-grant-helper-shadow.c
+++ b/src/polkit-grant/polkit-grant-helper-shadow.c
@@ -126,7 +126,6 @@ error:
 int do_auth (const char *user_to_auth)
 {
         struct spwd *shadow;
-        char *password;
         char buf[256];

         if ((shadow = getspnam (user_to_auth)) == NULL)
@@ -139,9 +138,7 @@ int do_auth (const char *user_to_auth)
                 buf[strlen (buf) - 1] == '\n')
                         buf[strlen (buf) - 1] = '\0';

-        password = strdup (buf);
-
-        if (strcmp (shadow->sp_pwdp, crypt (password, shadow->sp_pwdp)) != 0)
+        if (strcmp (shadow->sp_pwdp, crypt (buf, shadow->sp_pwdp)) != 0)
                 goto error;

         return 1;
-- 
1.5.4.3.448.ga661


--=-=-=


--------------------------------------------------------------
#2, above just fixes the problem.
This cleans up by renaming buf to a more readable "password".

(do_auth): Rename local: s/buf/password/

--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0003--do_auth-Rename-local-s-buf-password.patch



More information about the hal mailing list