[vlc-commits] file: do not use non-blocking mode when unknown/unspecified/useless
Rémi Denis-Courmont
git at videolan.org
Wed Jun 20 07:19:26 CEST 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jun 20 08:16:16 2012 +0300| [bd19904c7d2ab50b83d98c64244cb0d54ff46da7] | committer: 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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bd19904c7d2ab50b83d98c64244cb0d54ff46da7
---
modules/access/file.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules/access/file.c b/modules/access/file.c
index 5dd4a2a..7794316 100644
--- a/modules/access/file.c
+++ b/modules/access/file.c
@@ -182,6 +182,11 @@ int FileOpen( vlc_object_t *p_this )
msg_Err (p_access, "failed to read (%m)");
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
* how to parse the data. The directory plugin will do it. */
if (S_ISDIR (st.st_mode))
More information about the vlc-commits
mailing list