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
a2f2d51d
Commit
a2f2d51d
authored
Mar 31, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vlc_accept: accept() with close-on-exec
parent
eb1988c9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
1 deletion
+47
-1
include/vlc_fs.h
include/vlc_fs.h
+4
-1
src/libvlccore.sym
src/libvlccore.sym
+1
-0
src/text/filesystem.c
src/text/filesystem.c
+42
-0
No files found.
include/vlc_fs.h
View file @
a2f2d51d
...
...
@@ -54,6 +54,9 @@ VLC_EXPORT( int, vlc_lstat, ( const char *filename, struct stat *buf ) );
VLC_EXPORT
(
int
,
vlc_mkstemp
,
(
char
*
)
);
VLC_EXPORT
(
int
,
vlc_dup
,
(
int
)
);
int
vlc_socket
(
int
,
int
,
int
,
bool
nonblock
);
int
vlc_socket
(
int
,
int
,
int
,
bool
nonblock
)
LIBVLC_USED
;
struct
sockaddr
;
VLC_EXPORT
(
int
,
vlc_accept
,
(
int
,
struct
sockaddr
*
,
socklen_t
*
,
bool
)
LIBVLC_USED
);
#endif
src/libvlccore.sym
View file @
a2f2d51d
...
...
@@ -445,6 +445,7 @@ vlc_stat
vlc_unlink
vlc_rename
vlc_dup
vlc_accept
utf8_vfprintf
var_AddCallback
var_Change
...
...
src/text/filesystem.c
View file @
a2f2d51d
...
...
@@ -655,3 +655,45 @@ int vlc_socket (int pf, int type, int proto, bool nonblock)
#endif
return
fd
;
}
/**
* Accepts an inbound connection request on a listening socket.
* The new file descriptor has the close-on-exec flag set.
* @param lfd listening socket file descriptor
* @param addr pointer to the peer address or NULL [OUT]
* @param alen pointer to the length of the peer address or NULL [OUT]
* @param nonblock whether to put the new socket in non-blocking mode
* @return a new file descriptor, or -1 on error.
*/
int
vlc_accept
(
int
lfd
,
struct
sockaddr
*
addr
,
socklen_t
*
alen
,
bool
nonblock
)
{
#ifdef HAVE_ACCEPT4
int
flags
=
SOCK_CLOEXEC
;
if
(
nonblock
)
flags
|=
SOCK_NONBLOCK
;
do
{
int
fd
=
accept4
(
lfd
,
addr
,
alen
,
flags
);
if
(
fd
!=
-
1
)
return
fd
;
}
while
(
errno
==
EINTR
);
if
(
errno
!=
ENOSYS
)
return
-
1
;
#endif
#ifdef WIN32
errno
=
0
;
#endif
do
{
int
fd
=
accept
(
lfd
,
addr
,
alen
);
if
(
fd
!=
-
1
)
return
fd
;
}
while
(
errno
==
EINTR
);
return
-
1
;
}
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