From 0de8b6897b15b9ee881b42ad96b0720f9c17b556 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Wed, 29 Mar 2017 11:50:06 +0200 Subject: Close FD after trying to open a directory --- erts/emulator/drivers/unix/unix_efile.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'erts/emulator/drivers') 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); } -- cgit v1.2.3