Commit bd19904c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

file: do not use non-blocking mode when unknown/unspecified/useless

For FIFO and sockets, non-blocking is wanted. For character device,
the effects depend on the device driver. For other types, non-blocking
mode has either no effects or is unspecified.
parent 219e1719
...@@ -182,6 +182,11 @@ int FileOpen( vlc_object_t *p_this ) ...@@ -182,6 +182,11 @@ int FileOpen( vlc_object_t *p_this )
msg_Err (p_access, "failed to read (%m)"); msg_Err (p_access, "failed to read (%m)");
goto error; goto error;
} }
if (!S_ISFIFO (st.st_mode) && !S_ISSOCK (st.st_mode))
/* Clear non-blocking mode when not useful or not specified */
fcntl (fd, F_SETFL, fcntl (fd, F_GETFL) & ~O_NONBLOCK);
/* Directories can be opened and read from, but only readdir() knows /* Directories can be opened and read from, but only readdir() knows
* how to parse the data. The directory plugin will do it. */ * how to parse the data. The directory plugin will do it. */
if (S_ISDIR (st.st_mode)) if (S_ISDIR (st.st_mode))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment