projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix shm_open wrongly being cancellable
[musl]
/
src
/
passwd
/
getpwent.c
diff --git
a/src/passwd/getpwent.c
b/src/passwd/getpwent.c
index
dabd411
..
c655135
100644
(file)
--- a/
src/passwd/getpwent.c
+++ b/
src/passwd/getpwent.c
@@
-15,7
+15,7
@@
struct passwd *getpwent()
static char *line;
static struct passwd pw;
size_t size=0;
static char *line;
static struct passwd pw;
size_t size=0;
- if (!f) f = fopen("/etc/passwd", "rb");
+ if (!f) f = fopen("/etc/passwd", "rb
e
");
if (!f) return 0;
return __getpwent_a(f, &pw, &line, &size);
}
if (!f) return 0;
return __getpwent_a(f, &pw, &line, &size);
}
@@
-23,17
+23,23
@@
struct passwd *getpwent()
struct passwd *getpwuid(uid_t uid)
{
struct passwd *pw;
struct passwd *getpwuid(uid_t uid)
{
struct passwd *pw;
+ int errno_saved;
setpwent();
while ((pw=getpwent()) && pw->pw_uid != uid);
setpwent();
while ((pw=getpwent()) && pw->pw_uid != uid);
+ errno_saved = errno;
endpwent();
endpwent();
+ errno = errno_saved;
return pw;
}
struct passwd *getpwnam(const char *name)
{
struct passwd *pw;
return pw;
}
struct passwd *getpwnam(const char *name)
{
struct passwd *pw;
+ int errno_saved;
setpwent();
while ((pw=getpwent()) && strcmp(pw->pw_name, name));
setpwent();
while ((pw=getpwent()) && strcmp(pw->pw_name, name));
+ errno_saved = errno;
endpwent();
endpwent();
+ errno = errno_saved;
return pw;
}
return pw;
}