summaryrefslogtreecommitdiff
path: root/libc/pwd_grp/pwd_grp.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2004-02-11 23:48:50 +0000
committerManuel Novoa III <mjn3@codepoet.org>2004-02-11 23:48:50 +0000
commit082e680bd54e999f2bb4eb77141958938b1e9ee9 (patch)
tree203c45b85ca608e1550d8ffc459456fc9cf0b30b /libc/pwd_grp/pwd_grp.c
parent17c21765b4a97c6f0b74ba8466073e5a3f97cdee (diff)
New stdio core. Should be more maintainable. Fixes a couple of bugs.
Codepaths streamlined. Improved performance for nonthreaded apps when linked with a thread-enabled libc. Minor iconv bug and some locale/thread related startup issues fixed. These showed up in getting a gcj-compiled java helloworld app running. Removed some old extension functions... _stdio_fdout and _stdio_fsfopen.
Diffstat (limited to 'libc/pwd_grp/pwd_grp.c')
-rw-r--r--libc/pwd_grp/pwd_grp.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libc/pwd_grp/pwd_grp.c b/libc/pwd_grp/pwd_grp.c
index d3047e760..90b4eafd6 100644
--- a/libc/pwd_grp/pwd_grp.c
+++ b/libc/pwd_grp/pwd_grp.c
@@ -777,11 +777,12 @@ int putgrent(const struct group *__restrict p, FILE *__restrict f)
char **m;
const char *fmt;
int rv = -1;
+ __STDIO_AUTO_THREADLOCK_VAR;
if (!p || !f) { /* Sigh... glibc checks. */
__set_errno(EINVAL);
} else {
- __STDIO_THREADLOCK(f);
+ __STDIO_AUTO_THREADLOCK(f);
if (fprintf(f, "%s:%s:%lu:",
p->gr_name, p->gr_passwd,
@@ -809,7 +810,7 @@ int putgrent(const struct group *__restrict p, FILE *__restrict f)
}
- __STDIO_THREADUNLOCK(f);
+ __STDIO_AUTO_THREADUNLOCK(f);
}
return rv;
@@ -835,10 +836,11 @@ int putspent(const struct spwd *p, FILE *stream)
long int x;
int i;
int rv = -1;
+ __STDIO_AUTO_THREADLOCK_VAR;
/* Unlike putpwent and putgrent, glibc does not check the args. */
- __STDIO_THREADLOCK(stream);
+ __STDIO_AUTO_THREADLOCK(stream);
if (fprintf(stream, "%s:%s:", p->sp_namp,
(p->sp_pwdp ? p->sp_pwdp : "")) < 0
@@ -865,7 +867,7 @@ int putspent(const struct spwd *p, FILE *stream)
}
DO_UNLOCK:
- __STDIO_THREADUNLOCK(stream);
+ __STDIO_AUTO_THREADUNLOCK(stream);
return rv;
}
@@ -1117,11 +1119,12 @@ int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data,
int line_len;
int skip;
int rv = ERANGE;
+ __STDIO_AUTO_THREADLOCK_VAR;
if (buflen < PWD_BUFFER_SIZE) {
__set_errno(rv);
} else {
- __STDIO_THREADLOCK(f);
+ __STDIO_AUTO_THREADLOCK(f);
skip = 0;
do {
@@ -1165,7 +1168,7 @@ int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data,
}
} while (1);
- __STDIO_THREADUNLOCK(f);
+ __STDIO_AUTO_THREADUNLOCK(f);
}
return rv;