Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
37ae6248
Commit
37ae6248
authored
Feb 14, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add vlc_openat wrapper around openat
parent
d38c4f98
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
0 deletions
+49
-0
include/vlc_fs.h
include/vlc_fs.h
+1
-0
src/libvlccore.sym
src/libvlccore.sym
+1
-0
src/text/filesystem.c
src/text/filesystem.c
+47
-0
No files found.
include/vlc_fs.h
View file @
37ae6248
...
...
@@ -33,6 +33,7 @@
VLC_EXPORT
(
int
,
vlc_open
,
(
const
char
*
filename
,
int
flags
,
...
)
LIBVLC_USED
);
VLC_EXPORT
(
FILE
*
,
vlc_fopen
,
(
const
char
*
filename
,
const
char
*
mode
)
LIBVLC_USED
);
VLC_EXPORT
(
int
,
vlc_openat
,
(
int
fd
,
const
char
*
filename
,
int
flags
,
...
)
LIBVLC_USED
);
VLC_EXPORT
(
DIR
*
,
vlc_opendir
,
(
const
char
*
dirname
)
LIBVLC_USED
);
VLC_EXPORT
(
char
*
,
vlc_readdir
,
(
DIR
*
dir
)
LIBVLC_USED
);
...
...
src/libvlccore.sym
View file @
37ae6248
...
...
@@ -434,6 +434,7 @@ utf8_lstat
vlc_mkdir
vlc_mkstemp
vlc_open
vlc_openat
vlc_opendir
vlc_readdir
vlc_scandir
...
...
src/text/filesystem.c
View file @
37ae6248
...
...
@@ -193,6 +193,53 @@ FILE *vlc_fopen (const char *filename, const char *mode)
return
stream
;
}
/**
* Opens a system file handle relative to an existing directory handle.
*
* @param dir directory file descriptor
* @param filename file path to open (with UTF-8 encoding)
* @param flags open() flags, see the C library open() documentation
* @return a file handle on success, -1 on error (see errno).
* @note Contrary to standard open(), this function returns file handles
* with the close-on-exec flag enabled.
*/
int
vlc_openat
(
int
dir
,
const
char
*
filename
,
int
flags
,
...)
{
unsigned
int
mode
=
0
;
va_list
ap
;
va_start
(
ap
,
flags
);
if
(
flags
&
O_CREAT
)
mode
=
va_arg
(
ap
,
unsigned
int
);
va_end
(
ap
);
#ifdef O_CLOEXEC
flags
|=
O_CLOEXEC
;
#endif
const
char
*
local_name
=
ToLocale
(
filename
);
if
(
local_name
==
NULL
)
{
errno
=
ENOENT
;
return
-
1
;
}
#ifdef HAVE_FDOPENDIR
int
fd
=
openat
(
dir
,
local_name
,
flags
,
mode
);
# ifdef HAVE_FCNTL
if
(
fd
!=
-
1
)
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
);
# endif
#else
int
fd
=
-
1
;
errno
=
ENOSYS
;
#endif
LocaleFree
(
local_name
);
return
fd
;
}
/**
* Creates a directory using UTF-8 paths.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment