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
13238382
Unverified
Commit
13238382
authored
Feb 08, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/lxc_unshare: satisfy Android
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
c6668710
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
lxc_unshare.c
src/lxc/tools/lxc_unshare.c
+18
-1
No files found.
src/lxc/tools/lxc_unshare.c
View file @
13238382
...
...
@@ -42,6 +42,23 @@
#include "arguments.h"
#include "tool_utils.h"
/* Define sethostname() if missing from the C library also workaround some
* quirky with having this defined in multiple places.
*/
static
inline
int
sethostname_including_android
(
const
char
*
name
,
size_t
len
)
{
#ifndef HAVE_SETHOSTNAME
#ifdef __NR_sethostname
return
syscall
(
__NR_sethostname
,
name
,
len
);
#else
errno
=
ENOSYS
;
return
-
1
;
#endif
#else
return
sethostname
(
name
,
len
);
#endif
}
struct
my_iflist
{
char
*
mi_ifname
;
...
...
@@ -127,7 +144,7 @@ static int do_start(void *arg)
lxc_setup_fs
();
if
((
flags
&
CLONE_NEWUTS
)
&&
want_hostname
)
if
(
sethostname
(
want_hostname
,
strlen
(
want_hostname
))
<
0
)
{
if
(
sethostname
_including_android
(
want_hostname
,
strlen
(
want_hostname
))
<
0
)
{
fprintf
(
stderr
,
"failed to set hostname %s: %s
\n
"
,
want_hostname
,
strerror
(
errno
));
exit
(
EXIT_FAILURE
);
}
...
...
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