|------------------------|-------------------|
| Type | Function |
|------------------------|-------------------|
| Calling risky function | close_on_exec_dup |
| Calling risky function | remove_indir |
|------------------------|-------------------|
Change-Id: I3bdd110fbbb7ac2abe049a2045e73b28b6917417
S-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
if (dup2(old, new) != -1) {
unsigned long flags = fcntl(new, F_GETFD);
if (flags == -1) {
- LOGE("can not get flags fd #%d <%s>\n", new,
- strerror(errno));
+ LOGE("can not get flags fd #%d errno <%d>\n", new,
+ errno);
goto err_ret;
}
if (fcntl(new, F_SETFD, flags | FD_CLOEXEC) == -1) {
- LOGE("can not get flags fd #%d <%s>\n", new,
- strerror(errno));
+ LOGE("can not get flags fd #%d errno <%d>\n", new,
+ errno);
goto err_ret;
}
} else {
{
DIR *dir;
struct dirent *entry;
+ static char dirent_buffer[ sizeof(struct dirent) + PATH_MAX + 1 ] = {0,};
+ static struct dirent *dirent_r = (struct dirent *)dirent_buffer;
char path[PATH_MAX];
dir = opendir(dirname);
return -1;
}
- while((entry = readdir(dir)) != NULL)
- {
+ while ((readdir_r(dir, dirent_r, &entry) == 0) && entry) {
if (strcmp(entry->d_name, ".") && strcmp(entry->d_name, ".."))
{
snprintf(path, (size_t) PATH_MAX, "%s/%s", dirname, entry->d_name);