aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2018-02-28 09:21:16 +0100
committerJohn Högberg <[email protected]>2018-02-28 09:21:16 +0100
commitd77627f1c80ca6074a59a714b0bc37b99f6cb06b (patch)
treec1c68bad6441e7812476fd869b353772b6d52bf9 /erts/emulator
parent0c9475586ca0c057a237287eca50e6ebb6aec0e5 (diff)
parent6f120d4ab4fab2231f7475256bcc1eeac2bfe6e5 (diff)
downloadotp-d77627f1c80ca6074a59a714b0bc37b99f6cb06b.tar.gz
otp-d77627f1c80ca6074a59a714b0bc37b99f6cb06b.tar.bz2
otp-d77627f1c80ca6074a59a714b0bc37b99f6cb06b.zip
Merge branch 'john/erts/allow-opening-device-files/OTP-11462'
* john/erts/allow-opening-device-files/OTP-11462: Allow opening device files and FIFOs with file:open/2
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/nifs/unix/unix_prim_file.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/erts/emulator/nifs/unix/unix_prim_file.c b/erts/emulator/nifs/unix/unix_prim_file.c
index 57c8ef62e1..4a6c476882 100644
--- a/erts/emulator/nifs/unix/unix_prim_file.c
+++ b/erts/emulator/nifs/unix/unix_prim_file.c
@@ -125,24 +125,11 @@ static int open_file_type_check(const efile_path_t *path, int fd) {
* immediately in a read within the call, but the new implementation
* never does that. */
return 1;
- } else {
- /* The old driver tolerated opening /dev/null despite the "no devices"
- * limitation. It provided no explanation for this but we still need
- * to match the behavior. We're checking through stat(2) instead of
- * comparing the name to account for links. */
- struct stat null_device_info;
- int is_dev_null;
-
- is_dev_null = (stat("/dev/null", &null_device_info) == 0);
- is_dev_null &= (file_info.st_ino == null_device_info.st_ino);
- is_dev_null &= (file_info.st_dev == null_device_info.st_dev);
-
- if(is_dev_null) {
- return 1;
- }
}
- if(!S_ISREG(file_info.st_mode)) {
+ /* Allow everything that isn't a directory, and error out on the next call
+ * if it's unsupported. */
+ if(S_ISDIR(file_info.st_mode)) {
return 0;
}