aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2017-03-31 12:58:34 +0200
committerErlang/OTP <[email protected]>2017-03-31 12:58:34 +0200
commite29f48616d61b9ef53d79280d5a5f46bd9765d9a (patch)
treeed31e30442794e351ebef18b58a0e41ba28df1f9 /erts/emulator
parentcb1b5ecaf0fb8740e114b127efd0b86f279e9f7f (diff)
parent0de8b6897b15b9ee881b42ad96b0720f9c17b556 (diff)
downloadotp-e29f48616d61b9ef53d79280d5a5f46bd9765d9a.tar.gz
otp-e29f48616d61b9ef53d79280d5a5f46bd9765d9a.tar.bz2
otp-e29f48616d61b9ef53d79280d5a5f46bd9765d9a.zip
Merge branch 'raimo/file-read_file-leaks-file-descriptors/ERL-383/OTP-14308' into maint-19
* raimo/file-read_file-leaks-file-descriptors/ERL-383/OTP-14308: Close FD after trying to open a directory
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/drivers/unix/unix_efile.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/erts/emulator/drivers/unix/unix_efile.c b/erts/emulator/drivers/unix/unix_efile.c
index 3ff68a8859..0acc2432a7 100644
--- a/erts/emulator/drivers/unix/unix_efile.c
+++ b/erts/emulator/drivers/unix/unix_efile.c
@@ -430,6 +430,9 @@ efile_openfile(Efile_error* errInfo, /* Where to return error codes. */
if ( (stat("/dev/null", &nullstatbuf) < 0)
|| (statbuf.st_ino != nullstatbuf.st_ino)
|| (statbuf.st_dev != nullstatbuf.st_dev) ) {
+#ifdef HAVE_FSTAT
+ efile_closefile(fd);
+#endif
errno = EISDIR;
return check_error(-1, errInfo);
}