libpwdgrp: fix thinko in getpwnam
authorTito Ragusa <farmatito@tiscali.it>
Thu, 19 Feb 2015 21:02:59 +0000 (22:02 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 19 Feb 2015 21:03:56 +0000 (22:03 +0100)
function                                             old     new   delta
parse_file                                             -      64     +64
getXXnam_r                                           162     138     -24
getXXnam                                              90      50     -40
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 64/-64)              Total: 0 bytes

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libpwdgrp/pwd_grp.c

index 7ec704ee4e8bd06b06f5d26d18be584f557d971e..3886facf0af77fe4a6b19c590e6bb4669f099a27 100644 (file)
@@ -450,15 +450,7 @@ static void* FAST_FUNC getXXnam(const char *name, unsigned db_and_field_pos)
        char *buf;
        struct passdb *db = &get_S()->db[db_and_field_pos >> 2];
 
-       if (!db->fp) {
-               db->fp = fopen_for_read(db->filename);
-               if (!db->fp) {
-                       return NULL;
-               }
-               close_on_exec_on(fileno(db->fp));
-       }
-
-       buf = parse_common(db->fp, db, name, db_and_field_pos & 3);
+       buf = parse_file(db, name, db_and_field_pos & 3);
        return massage_data_for_non_r_func(db, buf);
 }