Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
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
Chen Yisong
lxc
Commits
521c8079
Unverified
Commit
521c8079
authored
Feb 26, 2018
by
Stéphane Graber
Committed by
GitHub
Feb 26, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2188 from brauner/2018-02-16/coding_style
CODING_STYLE: add section about _exit()
parents
69556eaf
44dec7ef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
CODING_STYLE.md
CODING_STYLE.md
+5
-0
parse.c
src/lxc/parse.c
+3
-2
No files found.
CODING_STYLE.md
View file @
521c8079
...
@@ -512,3 +512,8 @@ rules to use them:
...
@@ -512,3 +512,8 @@ rules to use them:
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
```
```
#### Use `_exit()` To Terminate `fork()`ed Child Processes
-
When
`fork()`
ing off a child process use
`_exit()`
to terminate it instead of
`exit()`
. The
`exit()`
function is not thread-safe and thus not suited for
the shared library which must ensure that it is thread-safe.
src/lxc/parse.c
View file @
521c8079
...
@@ -67,9 +67,10 @@ int lxc_strmunmap(void *addr, size_t length)
...
@@ -67,9 +67,10 @@ int lxc_strmunmap(void *addr, size_t length)
int
lxc_file_for_each_line_mmap
(
const
char
*
file
,
lxc_file_cb
callback
,
int
lxc_file_for_each_line_mmap
(
const
char
*
file
,
lxc_file_cb
callback
,
void
*
data
)
void
*
data
)
{
{
int
fd
,
ret
;
int
fd
;
char
*
buf
,
*
line
;
char
*
buf
,
*
line
;
struct
stat
st
;
struct
stat
st
;
int
ret
=
0
;
char
*
saveptr
=
NULL
;
char
*
saveptr
=
NULL
;
fd
=
open
(
file
,
O_RDONLY
|
O_CLOEXEC
);
fd
=
open
(
file
,
O_RDONLY
|
O_CLOEXEC
);
...
@@ -105,7 +106,7 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback,
...
@@ -105,7 +106,7 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback,
lxc_strmunmap
(
buf
,
st
.
st_size
);
lxc_strmunmap
(
buf
,
st
.
st_size
);
close
(
fd
);
close
(
fd
);
return
0
;
return
ret
;
}
}
int
lxc_file_for_each_line
(
const
char
*
file
,
lxc_file_cb
callback
,
void
*
data
)
int
lxc_file_for_each_line
(
const
char
*
file
,
lxc_file_cb
callback
,
void
*
data
)
...
...
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