Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
869b04e8
Commit
869b04e8
authored
Aug 06, 2013
by
Rémi Denis-Courmont
Committed by
Anton Khirnov
Aug 07, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libavutil: add avpriv_open() to open files with close-on-exec flag
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
22c87905
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
file.c
libavutil/file.c
+24
-1
internal.h
libavutil/internal.h
+5
-0
No files found.
libavutil/file.c
View file @
869b04e8
...
...
@@ -18,8 +18,10 @@
#include "config.h"
#include "file.h"
#include "internal.h"
#include "log.h"
#include "mem.h"
#include <stdarg.h>
#include <fcntl.h>
#include <sys/stat.h>
#if HAVE_UNISTD_H
...
...
@@ -34,6 +36,27 @@
#include <windows.h>
#endif
int
avpriv_open
(
const
char
*
filename
,
int
flags
,
...)
{
int
fd
;
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
fd
=
open
(
filename
,
flags
,
mode
);
if
(
fd
!=
-
1
)
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
);
return
fd
;
}
typedef
struct
{
const
AVClass
*
class
;
int
log_offset
;
...
...
@@ -49,7 +72,7 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
int
log_offset
,
void
*
log_ctx
)
{
FileLogContext
file_log_ctx
=
{
&
file_log_ctx_class
,
log_offset
,
log_ctx
};
int
err
,
fd
=
open
(
filename
,
O_RDONLY
);
int
err
,
fd
=
avpriv_
open
(
filename
,
O_RDONLY
);
struct
stat
st
;
av_unused
void
*
ptr
;
off_t
off_size
;
...
...
libavutil/internal.h
View file @
869b04e8
...
...
@@ -196,4 +196,9 @@ void avpriv_report_missing_feature(void *avc,
void
avpriv_request_sample
(
void
*
avc
,
const
char
*
msg
,
...)
av_printf_format
(
2
,
3
);
/**
* A wrapper for open() setting O_CLOEXEC.
*/
int
avpriv_open
(
const
char
*
filename
,
int
flags
,
...);
#endif
/* AVUTIL_INTERNAL_H */
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