summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sudoers/toke.c3
-rw-r--r--plugins/sudoers/toke.l3
2 files changed, 4 insertions, 2 deletions
diff --git a/plugins/sudoers/toke.c b/plugins/sudoers/toke.c
index f71712c29..670357600 100644
--- a/plugins/sudoers/toke.c
+++ b/plugins/sudoers/toke.c
@@ -5862,7 +5862,8 @@ push_include_int(const char *opath, bool isdir, int verbose)
fd = sudo_open_conf_path(path, dname, sizeof(dname), NULL);
status = sudo_secure_fd(fd, S_IFDIR, sudoers_uid, sudoers_gid, &sb);
- close(fd); /* XXX use in read_dir_files? */
+ if (fd != -1)
+ close(fd); /* XXX use in read_dir_files? */
if (status != SUDO_PATH_SECURE) {
if (verbose > 0) {
switch (status) {
diff --git a/plugins/sudoers/toke.l b/plugins/sudoers/toke.l
index 1d265f68c..fdcd27232 100644
--- a/plugins/sudoers/toke.l
+++ b/plugins/sudoers/toke.l
@@ -1315,7 +1315,8 @@ push_include_int(const char *opath, bool isdir, int verbose)
fd = sudo_open_conf_path(path, dname, sizeof(dname), NULL);
status = sudo_secure_fd(fd, S_IFDIR, sudoers_uid, sudoers_gid, &sb);
- close(fd); /* XXX use in read_dir_files? */
+ if (fd != -1)
+ close(fd); /* XXX use in read_dir_files? */
if (status != SUDO_PATH_SECURE) {
if (verbose > 0) {
switch (status) {