>Number:         165527
>Category:       bin
>Synopsis:       setgroupent() does not make file descrptors opened
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 28 11:50:08 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Andrey Simonenko
>Release:        FreeBSD 10.0-CURRENT amd64
>Organization:
>Environment:
>Description:

If the setgroupent() library function is called with non-zero argument,
then file descriptors used for accessing databases should be left opened.
Actually this does not work and reduce performance.

>How-To-Repeat:
>Fix:
--- getgrent.c.orig     2007-12-12 12:08:02.000000000 +0200
+++ getgrent.c  2012-02-28 11:00:23.000000000 +0200
@@ -811,6 +811,7 @@ files_setgrent(void *retval, void *mdata
                        rewind(st->fp);
                else if (stayopen)
                        st->fp = fopen(_PATH_GROUP, "r");
+               st->stayopen = stayopen;
                break;
        case ENDGRENT:
                if (st->fp != NULL) {
@@ -1252,6 +1253,7 @@ compat_setgrent(void *retval, void *mdat
                        rewind(st->fp);
                else if (stayopen)
                        st->fp = fopen(_PATH_GROUP, "r");
+               st->stayopen = stayopen;
                set_setent(dtab, mdata);
                (void)_nsdispatch(NULL, dtab, NSDB_GROUP_COMPAT, "setgrent",
                    compatsrc, 0);
>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to