FreeBSD Bugzilla – Attachment 221430 Details for
Bug 252094
nss "compat": getpw(nam|uid)_r(3) inadvertently reset next entry key for getpwent_r(3)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Avoid side-effects from getgr(nam|gid) on getgrent: take III
grp.diff (text/plain), 2.14 KB, created by
Viktor Dukhovni
on 2021-01-09 21:04:58 UTC
(
hide
)
Description:
Avoid side-effects from getgr(nam|gid) on getgrent: take III
Filename:
MIME Type:
Creator:
Viktor Dukhovni
Created:
2021-01-09 21:04:58 UTC
Size:
2.14 KB
patch
obsolete
>Index: getgrent.c >=================================================================== >--- getgrent.c (revision 367119) >+++ getgrent.c (working copy) >@@ -869,16 +869,12 @@ > } > fresh = 1; > } >- if (how == nss_lt_all) >- stayopen = 1; >- else { >- if (!fresh) >- rewind(st->fp); >- stayopen = st->stayopen; >- } >- rv = NS_NOTFOUND; >+ stayopen = (how == nss_lt_all || !fresh) ? 1 : st->stayopen; > if (stayopen) > pos = ftello(st->fp); >+ if (how != nss_lt_all && !fresh) >+ rewind(st->fp); >+ rv = NS_NOTFOUND; > while ((line = fgetln(st->fp, &linesize)) != NULL) { > if (line[linesize-1] == '\n') > linesize--; >@@ -900,7 +896,7 @@ > &buffer[linesize + 1], bufsize - linesize - 1, errnop); > if (rv & NS_TERMINATE) > break; >- if (stayopen) >+ if (how == nss_lt_all) > pos = ftello(st->fp); > } > if (st->fp != NULL && !stayopen) { >@@ -907,6 +903,8 @@ > fclose(st->fp); > st->fp = NULL; > } >+ if (st->ftp != NULL && how != nss_lt_all) >+ fseeko(st->fp, pos, SEEK_SET); > if (rv == NS_SUCCESS && retval != NULL) > *(struct group **)retval = grp; > else if (rv == NS_RETURN && *errnop == ERANGE && st->fp != NULL) >@@ -1351,13 +1349,11 @@ > } > fresh = 1; > } >- if (how == nss_lt_all) >- stayopen = 1; >- else { >- if (!fresh) >- rewind(st->fp); >- stayopen = st->stayopen; >- } >+ stayopen = (how == nss_lt_all || !fresh) ? 1 : st->stayopen; >+ if (stayopen) >+ pos = ftello(st->fp); >+ if (how != nss_lt_all && !fresh) >+ rewind(st->fp); > docompat: > switch (st->compat) { > case COMPAT_MODE_ALL: >@@ -1418,8 +1414,6 @@ > break; > } > rv = NS_NOTFOUND; >- if (stayopen) >- pos = ftello(st->fp); > while ((line = fgetln(st->fp, &linesize)) != NULL) { > if (line[linesize-1] == '\n') > linesize--; >@@ -1460,7 +1454,7 @@ > &buffer[linesize + 1], bufsize - linesize - 1, errnop); > if (rv & NS_TERMINATE) > break; >- if (stayopen) >+ if (how == nss_lt_all) > pos = ftello(st->fp); > } > fin: >@@ -1468,6 +1462,8 @@ > fclose(st->fp); > st->fp = NULL; > } >+ if (st->fp != NULL && how != nss_lt_all) >+ fseeko(st->fp, pos, SEEK_SET); > if (rv == NS_SUCCESS && retval != NULL) > *(struct group **)retval = grp; > else if (rv == NS_RETURN && *errnop == ERANGE && st->fp != NULL)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 252094
:
220877
|
221404
|
221407
| 221430