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, "rbe");
if (f) {
if (getline(&sys_path, (size_t[1]){0}, f) > 0)
sys_path[strlen(sys_path)-1]=0;
void setusershell(void)
{
- if (!f) f = fopen("/etc/shells", "rb");
+ if (!f) f = fopen("/etc/shells", "rbe");
if (!f) f = fmemopen((void *)defshells, sizeof defshells - 1, "rb");
}
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
- f = fopen("/etc/group", "rb");
+ f = fopen("/etc/group", "rbe");
if (!f) {
rv = errno;
goto done;
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", "rbe");
if (!f) return 0;
return __getgrent_a(f, &gr, &line, &size, &mem, &nmem);
}
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
- f = fopen("/etc/passwd", "rb");
+ f = fopen("/etc/passwd", "rbe");
if (!f) {
rv = errno;
goto done;
static char *line;
static struct passwd pw;
size_t size=0;
- if (!f) f = fopen("/etc/passwd", "rb");
+ if (!f) f = fopen("/etc/passwd", "rbe");
if (!f) return 0;
return __getpwent_a(f, &pw, &line, &size);
}
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;
return errno;
}
} else {
- f = fopen("/etc/shadow", "rb");
+ f = fopen("/etc/shadow", "rbe");
if (!f) return errno;
}
goto out;
}
- f = fopen(datemsk, "r");
+ f = fopen(datemsk, "rbe");
if (!f) {
if (errno == ENOMEM) getdate_err = 6;
else getdate_err = 2;