Commit da7b4234 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.
(cherry picked from commit bd19904c)
parent 95870a60
...@@ -192,6 +192,11 @@ int FileOpen( vlc_object_t *p_this ) ...@@ -192,6 +192,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