From: Cristian Rodríguez Date: Fri, 16 Dec 2011 17:46:52 +0000 (-0300) Subject: Open more file descriptors with O_CLOEXEC X-Git-Tag: v2~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8e3e5839a0d65e7a779d4130f9ece02fa88af7e2;p=thirdparty%2Fkmod.git Open more file descriptors with O_CLOEXEC --- diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c index 1ba14cc5..b9ef0cdf 100644 --- a/libkmod/libkmod-config.c +++ b/libkmod/libkmod-config.c @@ -548,7 +548,7 @@ int kmod_config_new(struct kmod_ctx *ctx, struct kmod_config **p_config, } if (S_ISREG(st.st_mode)) { - int fd = open(path, O_RDONLY); + int fd = open(path, O_RDONLY|O_CLOEXEC); DBG(ctx, "parsing file '%s': %d\n", path, fd); if (fd >= 0) kmod_config_parse(config, fd, path); @@ -562,7 +562,7 @@ int kmod_config_new(struct kmod_ctx *ctx, struct kmod_config **p_config, d = conf_files_list(ctx, &list, path); for (; list != NULL; list = kmod_list_remove(list)) { - int fd = openat(dirfd(d), list->data, O_RDONLY); + int fd = openat(dirfd(d), list->data, O_RDONLY|O_CLOEXEC); DBG(ctx, "parsing file '%s/%s': %d\n", path, (const char *) list->data, fd); if (fd >= 0) diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c index 8d703141..80da684b 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c @@ -1333,7 +1333,7 @@ KMOD_EXPORT struct kmod_list *kmod_module_get_sections(const struct kmod_module continue; } - fd = openat(dfd, de.d_name, O_RDONLY); + fd = openat(dfd, de.d_name, O_RDONLY|O_CLOEXEC); if (fd < 0) { ERR(mod->ctx, "could not open '%s/%s': %m\n", dname, de.d_name);