-
-/*****************************************************************************
- * open_file: Opens a specific file
- *****************************************************************************/
-static int open_file (access_t *p_access, const char *path)
-{
-#if defined(WIN32)
- if (!strcasecmp (p_access->psz_access, "file")
- && ('/' == path[0]) && isalpha (path[1])
- && (':' == path[2]) && ('/' == path[3]))
- /* Explorer can open path such as file:/C:/ or file:///C:/
- * hence remove leading / if found */
- path++;
-#endif
-
- int fd = utf8_open (path, O_RDONLY | O_NONBLOCK /* O_LARGEFILE*/, 0666);
- if (fd == -1)
- {
- msg_Err (p_access, "cannot open file %s (%m)", path);
- intf_UserFatal (p_access, false, _("File reading failed"),
- _("VLC could not open the file \"%s\"."), path);
- return -1;
- }
-
-#if defined(HAVE_FCNTL_H)
- fcntl (fd, F_SETFD, fcntl (fd, F_GETFD) | FD_CLOEXEC);
-
- /* We'd rather use any available memory for reading ahead
- * than for caching what we've already seen/heard */
-# if defined(F_RDAHEAD)
- fcntl (fd, F_RDAHEAD, 1);
-# endif
-# if defined(F_NOCACHE)
- fcntl (fd, F_NOCACHE, 1);
-# endif
-#endif
-
- return fd;
-}