[MPlayer-cvslog] r32499 - trunk/input/input.c

reimar subversion at mplayerhq.hu
Sun Oct 17 11:06:18 CEST 2010


Author: reimar
Date: Sun Oct 17 11:06:18 2010
New Revision: 32499

Log:
Make code clearer by putting the "special case hack" inside the if.

Modified:
   trunk/input/input.c

Modified: trunk/input/input.c
==============================================================================
--- trunk/input/input.c	Sun Oct 17 10:59:41 2010	(r32498)
+++ trunk/input/input.c	Sun Oct 17 11:06:18 2010	(r32499)
@@ -1786,12 +1786,12 @@ mp_input_init(void) {
 
   if(in_file) {
     struct stat st;
-    // use RDWR for FIFOs to ensure they stay open over multiple accesses
-    int mode = O_RDWR;
-    // e.g. on Windows stat may fail for named pipes, trying to open read-only
-    // is a safe choice.
-    if (stat(in_file,&st) || !S_ISFIFO(st.st_mode))
-      mode = O_RDONLY;
+    int mode = O_RDONLY;
+    // Use RDWR for FIFOs to ensure they stay open over multiple accesses.
+    // Note that on Windows stat may fail for named pipes, but due to how the
+    // API works, using RDONLY should be ok.
+    if (stat(in_file,&st) == 0 && S_ISFIFO(st.st_mode))
+      mode = O_RDWR;
     in_file_fd = open(in_file, mode);
     if(in_file_fd >= 0)
       mp_input_add_cmd_fd(in_file_fd,1,NULL,(mp_close_func_t)close);


More information about the MPlayer-cvslog mailing list