Date: Tue, 28 Feb 2012 13:40:23 +0200 From: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/165527: setgroupent() does not make file descrptors opened Message-ID: <20120228114023.GA68878@pm513-1.comsys.ntu-kpi.kiev.ua> Resent-Message-ID: <201202281150.q1SBo8Ik010984@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120228114023.GA68878>
