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

file: set the non-blocking flag on pipes and sockets passed as fd://

(cherry picked from commit ed68c13d)
parent 58faf523
...@@ -193,10 +193,15 @@ int FileOpen( vlc_object_t *p_this ) ...@@ -193,10 +193,15 @@ int FileOpen( vlc_object_t *p_this )
goto error; goto error;
} }
#ifdef S_ISSOCK #if O_NONBLOCK
if (!S_ISFIFO (st.st_mode) && !S_ISSOCK (st.st_mode)) int flags = fcntl (fd, F_GETFL);
/* Clear non-blocking mode when not useful or not specified */ if (S_ISFIFO (st.st_mode) || S_ISSOCK (st.st_mode))
fcntl (fd, F_SETFL, fcntl (fd, F_GETFL) & ~O_NONBLOCK); /* Force non-blocking mode where applicable (fd://) */
flags |= O_NONBLOCK;
else
/* Force blocking mode when not useful or not specified */
flags &= ~O_NONBLOCK;
fcntl (fd, F_SETFL, flags);
#endif #endif
/* Directories can be opened and read from, but only readdir() knows /* Directories can be opened and read from, but only readdir() knows
......
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