Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
e0e6813a
Commit
e0e6813a
authored
Nov 10, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fd_util: removed creat_cloexec()
Add a "mode" argument to open_cloexec() instead.
parent
3d2a9d35
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
13 additions
and
39 deletions
+13
-39
fd_util.c
src/fd_util.c
+1
-21
fd_util.h
src/fd_util.h
+1
-8
file_input_plugin.c
src/input/file_input_plugin.c
+1
-1
log.c
src/log.c
+1
-1
oss_mixer_plugin.c
src/mixer/oss_mixer_plugin.c
+1
-1
fifo_output_plugin.c
src/output/fifo_output_plugin.c
+2
-2
mvp_plugin.c
src/output/mvp_plugin.c
+2
-2
oss_plugin.c
src/output/oss_plugin.c
+2
-2
recorder_output_plugin.c
src/output/recorder_output_plugin.c
+2
-1
No files found.
src/fd_util.c
View file @
e0e6813a
...
...
@@ -101,7 +101,7 @@ fd_set_nonblock(int fd)
}
int
open_cloexec
(
const
char
*
path_fs
,
int
flags
)
open_cloexec
(
const
char
*
path_fs
,
int
flags
,
int
mode
)
{
int
fd
;
...
...
@@ -113,26 +113,6 @@ open_cloexec(const char *path_fs, int flags)
flags
|=
O_NOCTTY
;
#endif
fd
=
open
(
path_fs
,
flags
,
0666
);
fd_set_cloexec
(
fd
,
true
);
return
fd
;
}
int
creat_cloexec
(
const
char
*
path_fs
,
int
mode
)
{
int
flags
=
O_CREAT
|
O_WRONLY
|
O_TRUNC
;
int
fd
;
#ifdef O_CLOEXEC
flags
|=
O_CLOEXEC
;
#endif
#ifdef O_NOCTTY
flags
|=
O_NOCTTY
;
#endif
fd
=
open
(
path_fs
,
flags
,
mode
);
fd_set_cloexec
(
fd
,
true
);
...
...
src/fd_util.h
View file @
e0e6813a
...
...
@@ -46,14 +46,7 @@ struct sockaddr;
* supported by the OS).
*/
int
open_cloexec
(
const
char
*
path_fs
,
int
flags
);
/**
* Wrapper for creat(), which sets the CLOEXEC flag (atomically if
* supported by the OS).
*/
int
creat_cloexec
(
const
char
*
path_fs
,
int
mode
);
open_cloexec
(
const
char
*
path_fs
,
int
flags
,
int
mode
);
/**
* Wrapper for pipe(), which sets the CLOEXEC flag (atomically if
...
...
src/input/file_input_plugin.c
View file @
e0e6813a
...
...
@@ -51,7 +51,7 @@ input_file_open(struct input_stream *is, const char *filename)
*
slash
=
'\0'
;
}
fd
=
open_cloexec
(
pathname
,
O_RDONLY
);
fd
=
open_cloexec
(
pathname
,
O_RDONLY
,
0
);
if
(
fd
<
0
)
{
is
->
error
=
errno
;
g_debug
(
"Failed to open
\"
%s
\"
: %s"
,
...
...
src/log.c
View file @
e0e6813a
...
...
@@ -129,7 +129,7 @@ open_log_file(void)
{
assert
(
out_filename
!=
NULL
);
return
open_cloexec
(
out_filename
,
O_CREAT
|
O_WRONLY
|
O_APPEND
);
return
open_cloexec
(
out_filename
,
O_CREAT
|
O_WRONLY
|
O_APPEND
,
0666
);
}
static
void
...
...
src/mixer/oss_mixer_plugin.c
View file @
e0e6813a
...
...
@@ -123,7 +123,7 @@ oss_mixer_open(struct mixer *data, GError **error_r)
{
struct
oss_mixer
*
om
=
(
struct
oss_mixer
*
)
data
;
om
->
device_fd
=
open_cloexec
(
om
->
device
,
O_RDONLY
);
om
->
device_fd
=
open_cloexec
(
om
->
device
,
O_RDONLY
,
0
);
if
(
om
->
device_fd
<
0
)
{
g_set_error
(
error_r
,
oss_mixer_quark
(),
errno
,
"failed to open %s: %s"
,
...
...
src/output/fifo_output_plugin.c
View file @
e0e6813a
...
...
@@ -153,7 +153,7 @@ fifo_open(struct fifo_data *fd, GError **error)
if
(
!
fifo_check
(
fd
,
error
))
return
false
;
fd
->
input
=
open_cloexec
(
fd
->
path
,
O_RDONLY
|
O_NONBLOCK
);
fd
->
input
=
open_cloexec
(
fd
->
path
,
O_RDONLY
|
O_NONBLOCK
,
0
);
if
(
fd
->
input
<
0
)
{
g_set_error
(
error
,
fifo_output_quark
(),
errno
,
"Could not open FIFO
\"
%s
\"
for reading: %s"
,
...
...
@@ -162,7 +162,7 @@ fifo_open(struct fifo_data *fd, GError **error)
return
false
;
}
fd
->
output
=
open_cloexec
(
fd
->
path
,
O_WRONLY
|
O_NONBLOCK
);
fd
->
output
=
open_cloexec
(
fd
->
path
,
O_WRONLY
|
O_NONBLOCK
,
0
);
if
(
fd
->
output
<
0
)
{
g_set_error
(
error
,
fifo_output_quark
(),
errno
,
"Could not open FIFO
\"
%s
\"
for writing: %s"
,
...
...
src/output/mvp_plugin.c
View file @
e0e6813a
...
...
@@ -116,7 +116,7 @@ mvp_output_test_default_device(void)
{
int
fd
;
fd
=
open_cloexec
(
"/dev/adec_pcm"
,
O_WRONLY
);
fd
=
open_cloexec
(
"/dev/adec_pcm"
,
O_WRONLY
,
0
);
if
(
fd
>=
0
)
{
close
(
fd
);
...
...
@@ -231,7 +231,7 @@ mvp_output_open(void *data, struct audio_format *audio_format, GError **error)
int
mix
[
5
]
=
{
0
,
2
,
7
,
1
,
0
};
bool
success
;
md
->
fd
=
open_cloexec
(
"/dev/adec_pcm"
,
O_RDWR
|
O_NONBLOCK
);
md
->
fd
=
open_cloexec
(
"/dev/adec_pcm"
,
O_RDWR
|
O_NONBLOCK
,
0
);
if
(
md
->
fd
<
0
)
{
g_set_error
(
error
,
mvp_output_quark
(),
errno
,
"Error opening /dev/adec_pcm: %s"
,
...
...
src/output/oss_plugin.c
View file @
e0e6813a
...
...
@@ -344,7 +344,7 @@ oss_output_test_default_device(void)
int
fd
,
i
;
for
(
i
=
G_N_ELEMENTS
(
default_devices
);
--
i
>=
0
;
)
{
fd
=
open_cloexec
(
default_devices
[
i
],
O_WRONLY
);
fd
=
open_cloexec
(
default_devices
[
i
],
O_WRONLY
,
0
);
if
(
fd
>=
0
)
{
close
(
fd
);
...
...
@@ -519,7 +519,7 @@ oss_open(struct oss_data *od, GError **error)
{
bool
success
;
od
->
fd
=
open_cloexec
(
od
->
device
,
O_WRONLY
);
od
->
fd
=
open_cloexec
(
od
->
device
,
O_WRONLY
,
0
);
if
(
od
->
fd
<
0
)
{
g_set_error
(
error
,
oss_output_quark
(),
errno
,
"Error opening OSS device
\"
%s
\"
: %s"
,
...
...
src/output/recorder_output_plugin.c
View file @
e0e6813a
...
...
@@ -157,7 +157,8 @@ recorder_output_open(void *data, struct audio_format *audio_format,
/* create the output file */
recorder
->
fd
=
creat_cloexec
(
recorder
->
path
,
0666
);
recorder
->
fd
=
open_cloexec
(
recorder
->
path
,
O_CREAT
|
O_WRONLY
|
O_TRUNC
,
0666
);
if
(
recorder
->
fd
<
0
)
{
g_set_error
(
error_r
,
recorder_output_quark
(),
0
,
"Failed to create '%s': %s"
,
...
...
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