diff options
author | Marcus Arendt <[email protected]> | 2014-06-04 11:50:32 +0200 |
---|---|---|
committer | Marcus Arendt <[email protected]> | 2014-06-04 11:50:32 +0200 |
commit | b0bfcd4ee5571b0d15c9539cf266f1903f25527c (patch) | |
tree | 8172b1f8a82143eddf88b311580e818cafd34e56 /erts/emulator | |
parent | 48327e7133e92cd609b733a30fdd3125f506c52c (diff) | |
parent | 596f214fc0275df8b19a8b36bb7b71e6affc6bd5 (diff) | |
download | otp-b0bfcd4ee5571b0d15c9539cf266f1903f25527c.tar.gz otp-b0bfcd4ee5571b0d15c9539cf266f1903f25527c.tar.bz2 otp-b0bfcd4ee5571b0d15c9539cf266f1903f25527c.zip |
Merge branch 'maint'
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/drivers/unix/unix_efile.c | 7 |
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. |