X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmountd%2Fcache.c;h=68cccdfddb70535f58c248798839fff5338ba656;hp=ce93e3cf61b66f5b3fdfb623bcddd94a130eaf87;hb=40aed2c3fb5164195a9975ae7f15ebd4b992839d;hpb=9274e94db85bac04e170414cb8e0f4be271cde90 diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index ce93e3c..68cccdf 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -138,7 +138,7 @@ static void auth_unix_gid(FILE *f) static gid_t *groups = NULL; static int groups_len = 0; gid_t *more_groups; - int ngroups = 0; + int ngroups; int rv, i; char *cp; @@ -147,9 +147,11 @@ static void auth_unix_gid(FILE *f) if (!groups) return; - groups_len = ngroups = INITIAL_MANAGED_GROUPS; + groups_len = INITIAL_MANAGED_GROUPS; } + ngroups = groups_len; + if (readline(fileno(f), &lbuf, &lbuflen) != 1) return; @@ -825,12 +827,13 @@ struct { char *cache_name; void (*cache_handle)(FILE *f); FILE *f; + char vbuf[RPC_CHAN_BUF_SIZE]; } cachelist[] = { - { "auth.unix.ip", auth_unix_ip, NULL}, - { "auth.unix.gid", auth_unix_gid, NULL}, - { "nfsd.export", nfsd_export, NULL}, - { "nfsd.fh", nfsd_fh, NULL}, - { NULL, NULL, NULL } + { "auth.unix.ip", auth_unix_ip, NULL, ""}, + { "auth.unix.gid", auth_unix_gid, NULL, ""}, + { "nfsd.export", nfsd_export, NULL, ""}, + { "nfsd.fh", nfsd_fh, NULL, ""}, + { NULL, NULL, NULL, ""} }; extern int manage_gids; @@ -848,6 +851,10 @@ void cache_open(void) continue; sprintf(path, "/proc/net/rpc/%s/channel", cachelist[i].cache_name); cachelist[i].f = fopen(path, "r+"); + if (cachelist[i].f != NULL) { + setvbuf(cachelist[i].f, cachelist[i].vbuf, _IOLBF, + RPC_CHAN_BUF_SIZE); + } } }