Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
34d4f313
Commit
34d4f313
authored
Aug 24, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filesystem: use native mkstemp() on POSIX
parent
75799939
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
src/posix/filesystem.c
src/posix/filesystem.c
+15
-8
src/text/filesystem.c
src/text/filesystem.c
+4
-1
No files found.
src/posix/filesystem.c
View file @
34d4f313
...
@@ -98,6 +98,20 @@ int vlc_openat (int dir, const char *filename, int flags, ...)
...
@@ -98,6 +98,20 @@ int vlc_openat (int dir, const char *filename, int flags, ...)
return
fd
;
return
fd
;
}
}
int
vlc_mkstemp
(
char
*
template
)
{
int
fd
;
#ifdef HAVE_MKOSTEMP
fd
=
mkostemp
(
template
,
O_CLOEXEC
);
#else
fd
=
mkstemp
(
template
);
#endif
if
(
fd
!=
-
1
)
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
);
return
fd
;
}
int
vlc_memfd
(
void
)
int
vlc_memfd
(
void
)
{
{
int
fd
;
int
fd
;
...
@@ -115,16 +129,9 @@ int vlc_memfd (void)
...
@@ -115,16 +129,9 @@ int vlc_memfd (void)
char
bufpath
[]
=
"/tmp/"
PACKAGE_NAME
"XXXXXX"
;
char
bufpath
[]
=
"/tmp/"
PACKAGE_NAME
"XXXXXX"
;
#ifdef HAVE_MKOSTEMP
fd
=
vlc_mkstemp
(
bufpath
);
fd
=
mkostemp
(
bufpath
,
O_CLOEXEC
);
#else
fd
=
mkstemp
(
bufpath
);
#endif
if
(
fd
!=
-
1
)
if
(
fd
!=
-
1
)
{
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
);
unlink
(
bufpath
);
unlink
(
bufpath
);
}
return
fd
;
return
fd
;
}
}
...
...
src/text/filesystem.c
View file @
34d4f313
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
#include <vlc_common.h>
#include <vlc_common.h>
#include <vlc_fs.h>
#include <vlc_fs.h>
#include <vlc_rand.h>
#include <assert.h>
#include <assert.h>
...
@@ -192,6 +191,9 @@ int vlc_scandir( const char *dirname, char ***namelist,
...
@@ -192,6 +191,9 @@ int vlc_scandir( const char *dirname, char ***namelist,
return
val
;
return
val
;
}
}
#if defined (_WIN32) || defined (__OS2__)
# include <vlc_rand.h>
int
vlc_mkstemp
(
char
*
template
)
int
vlc_mkstemp
(
char
*
template
)
{
{
static
const
char
digits
[]
=
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
;
static
const
char
digits
[]
=
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
;
...
@@ -231,3 +233,4 @@ int vlc_mkstemp( char *template )
...
@@ -231,3 +233,4 @@ int vlc_mkstemp( char *template )
errno
=
EEXIST
;
errno
=
EEXIST
;
return
-
1
;
return
-
1
;
}
}
#endif
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