aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorMarcus Arendt <[email protected]>2014-06-04 11:50:32 +0200
committerMarcus Arendt <[email protected]>2014-06-04 11:50:32 +0200
commitb0bfcd4ee5571b0d15c9539cf266f1903f25527c (patch)
tree8172b1f8a82143eddf88b311580e818cafd34e56 /erts
parent48327e7133e92cd609b733a30fdd3125f506c52c (diff)
parent596f214fc0275df8b19a8b36bb7b71e6affc6bd5 (diff)
downloadotp-b0bfcd4ee5571b0d15c9539cf266f1903f25527c.tar.gz
otp-b0bfcd4ee5571b0d15c9539cf266f1903f25527c.tar.bz2
otp-b0bfcd4ee5571b0d15c9539cf266f1903f25527c.zip
Merge branch 'maint'
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/drivers/unix/unix_efile.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/erts/emulator/drivers/unix/unix_efile.c b/erts/emulator/drivers/unix/unix_efile.c
index 42f41c5f3d..878beb055b 100644
--- a/erts/emulator/drivers/unix/unix_efile.c
+++ b/erts/emulator/drivers/unix/unix_efile.c
@@ -360,7 +360,12 @@ efile_openfile(Efile_error* errInfo, /* Where to return error codes. */
int fd;
int mode; /* Open mode. */
- if (stat(name, &statbuf) >= 0 && !ISREG(statbuf)) {
+ if (stat(name, &statbuf) < 0) {
+ /* statbuf is undefined: if the caller depends on it,
+ i.e. invoke_read_file(), fail the call immediately */
+ if (pSize && flags == EFILE_MODE_READ)
+ return check_error(-1, errInfo);
+ } else if (!ISREG(statbuf)) {
/*
* For UNIX only, here is some ugly code to allow
* /dev/null to be opened as a file.