projects
/
musl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8582a6e
)
more close-on-exec fixes, mostly using new "e" flag to fopen
author
Rich Felker
<dalias@aerifal.cx>
Sat, 29 Sep 2012 22:14:46 +0000
(18:14 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Sat, 29 Sep 2012 22:14:46 +0000
(18:14 -0400)
src/ldso/dynlink.c
patch
|
blob
|
history
src/legacy/getusershell.c
patch
|
blob
|
history
src/passwd/getgr_r.c
patch
|
blob
|
history
src/passwd/getgrent.c
patch
|
blob
|
history
src/passwd/getpw_r.c
patch
|
blob
|
history
src/passwd/getpwent.c
patch
|
blob
|
history
src/passwd/getspnam_r.c
patch
|
blob
|
history
src/time/getdate.c
patch
|
blob
|
history
diff --git
a/src/ldso/dynlink.c
b/src/ldso/dynlink.c
index
d0b57e8
..
960e089
100644
(file)
--- a/
src/ldso/dynlink.c
+++ b/
src/ldso/dynlink.c
@@
-438,7
+438,7
@@
static struct dso *load_library(const char *name)
if (fd < 0 && env_path) fd = path_open(name, env_path, buf, sizeof buf);
if (fd < 0) {
if (!sys_path) {
if (fd < 0 && env_path) fd = path_open(name, env_path, buf, sizeof buf);
if (fd < 0) {
if (!sys_path) {
- FILE *f = fopen(ETC_LDSO_PATH, "r");
+ FILE *f = fopen(ETC_LDSO_PATH, "r
be
");
if (f) {
if (getline(&sys_path, (size_t[1]){0}, f) > 0)
sys_path[strlen(sys_path)-1]=0;
if (f) {
if (getline(&sys_path, (size_t[1]){0}, f) > 0)
sys_path[strlen(sys_path)-1]=0;
diff --git
a/src/legacy/getusershell.c
b/src/legacy/getusershell.c
index
683158c
..
f31f404
100644
(file)
--- a/
src/legacy/getusershell.c
+++ b/
src/legacy/getusershell.c
@@
-17,7
+17,7
@@
void endusershell(void)
void setusershell(void)
{
void setusershell(void)
{
- if (!f) f = fopen("/etc/shells", "rb");
+ if (!f) f = fopen("/etc/shells", "rb
e
");
if (!f) f = fmemopen((void *)defshells, sizeof defshells - 1, "rb");
}
if (!f) f = fmemopen((void *)defshells, sizeof defshells - 1, "rb");
}
diff --git
a/src/passwd/getgr_r.c
b/src/passwd/getgr_r.c
index
1dc5f7e
..
234c901
100644
(file)
--- a/
src/passwd/getgr_r.c
+++ b/
src/passwd/getgr_r.c
@@
-16,7
+16,7
@@
static int getgr_r(const char *name, gid_t gid, struct group *gr, char *buf, siz
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
- f = fopen("/etc/group", "rb");
+ f = fopen("/etc/group", "rb
e
");
if (!f) {
rv = errno;
goto done;
if (!f) {
rv = errno;
goto done;
diff --git
a/src/passwd/getgrent.c
b/src/passwd/getgrent.c
index
4cbe1eb
..
429a3e5
100644
(file)
--- a/
src/passwd/getgrent.c
+++ b/
src/passwd/getgrent.c
@@
-15,7
+15,7
@@
struct group *getgrent()
static char *line, **mem;
static struct group gr;
size_t size=0, nmem=0;
static char *line, **mem;
static struct group gr;
size_t size=0, nmem=0;
- if (!f) f = fopen("/etc/group", "rb");
+ if (!f) f = fopen("/etc/group", "rb
e
");
if (!f) return 0;
return __getgrent_a(f, &gr, &line, &size, &mem, &nmem);
}
if (!f) return 0;
return __getgrent_a(f, &gr, &line, &size, &mem, &nmem);
}
diff --git
a/src/passwd/getpw_r.c
b/src/passwd/getpw_r.c
index
3974495
..
2855257
100644
(file)
--- a/
src/passwd/getpw_r.c
+++ b/
src/passwd/getpw_r.c
@@
-13,7
+13,7
@@
static int getpw_r(const char *name, uid_t uid, struct passwd *pw, char *buf, si
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
- f = fopen("/etc/passwd", "rb");
+ f = fopen("/etc/passwd", "rb
e
");
if (!f) {
rv = errno;
goto done;
if (!f) {
rv = errno;
goto done;
diff --git
a/src/passwd/getpwent.c
b/src/passwd/getpwent.c
index
e850146
..
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);
}
diff --git
a/src/passwd/getspnam_r.c
b/src/passwd/getspnam_r.c
index
9f3378e
..
f4d7b35
100644
(file)
--- a/
src/passwd/getspnam_r.c
+++ b/
src/passwd/getspnam_r.c
@@
-46,7
+46,7
@@
int getspnam_r(const char *name, struct spwd *sp, char *buf, size_t size, struct
if (snprintf(path, sizeof path, "/etc/tcb/%s/shadow", name) >= sizeof path)
return EINVAL;
if (snprintf(path, sizeof path, "/etc/tcb/%s/shadow", name) >= sizeof path)
return EINVAL;
- fd = open(path, O_RDONLY|O_NOFOLLOW|O_NONBLOCK);
+ fd = open(path, O_RDONLY|O_NOFOLLOW|O_NONBLOCK
|O_CLOEXEC
);
if (fd >= 0) {
struct stat st = { 0 };
errno = EINVAL;
if (fd >= 0) {
struct stat st = { 0 };
errno = EINVAL;
@@
-57,7
+57,7
@@
int getspnam_r(const char *name, struct spwd *sp, char *buf, size_t size, struct
return errno;
}
} else {
return errno;
}
} else {
- f = fopen("/etc/shadow", "rb");
+ f = fopen("/etc/shadow", "rb
e
");
if (!f) return errno;
}
if (!f) return errno;
}
diff --git
a/src/time/getdate.c
b/src/time/getdate.c
index
8ed650a
..
89f2169
100644
(file)
--- a/
src/time/getdate.c
+++ b/
src/time/getdate.c
@@
-22,7
+22,7
@@
struct tm *getdate(const char *s)
goto out;
}
goto out;
}
- f = fopen(datemsk, "r");
+ f = fopen(datemsk, "r
be
");
if (!f) {
if (errno == ENOMEM) getdate_err = 6;
else getdate_err = 2;
if (!f) {
if (errno == ENOMEM) getdate_err = 6;
else getdate_err = 2;