if we forget to close() in the future,
this prevent fd leak
Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
list_for_each_entry(p, &library_paths, list) {
snprintf(path, sizeof(path), "%s/%s", p->path, file);
- fd = open(path, O_RDONLY);
+ fd = open(path, O_RDONLY|O_CLOEXEC);
if (fd >= 0) {
*fullpath = strdup(path);
break;
if (path[0] == '/') {
if (avl_find(&mounts, path))
return 0;
- fd = open(path, O_RDONLY);
+ fd = open(path, O_RDONLY|O_CLOEXEC);
if (fd == -1)
return error;
add_mount(path, readonly, error);