Unverified Commit 521c8079 by Stéphane Graber Committed by GitHub

Merge pull request #2188 from brauner/2018-02-16/coding_style

CODING_STYLE: add section about _exit()
parents 69556eaf 44dec7ef
......@@ -512,3 +512,8 @@ rules to use them:
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.
......@@ -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,
void *data)
{
int fd, ret;
int fd;
char *buf, *line;
struct stat st;
int ret = 0;
char *saveptr = NULL;
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,
lxc_strmunmap(buf, st.st_size);
close(fd);
return 0;
return ret;
}
int lxc_file_for_each_line(const char *file, lxc_file_cb callback, void *data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment