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
80287d7d
Commit
80287d7d
authored
Jul 01, 2018
by
2xsec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: lxc-device: remove the trailing . & fix coding style of strncmp
Signed-off-by:
2xsec
<
dh48.jeong@samsung.com
>
parent
8f0bdb05
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
lxc_device.c
src/lxc/tools/lxc_device.c
+8
-8
No files found.
src/lxc/tools/lxc_device.c
View file @
80287d7d
...
...
@@ -64,7 +64,7 @@ static bool is_interface(const char *dev_name, pid_t pid)
{
pid_t
p
=
fork
();
if
(
p
<
0
)
{
ERROR
(
"Failed to fork task
.
"
);
ERROR
(
"Failed to fork task"
);
exit
(
EXIT_FAILURE
);
}
...
...
@@ -72,7 +72,7 @@ static bool is_interface(const char *dev_name, pid_t pid)
struct
ifaddrs
*
interfaceArray
=
NULL
,
*
tempIfAddr
=
NULL
;
if
(
!
switch_to_ns
(
pid
,
"net"
))
{
ERROR
(
"Failed to enter netns of container
.
"
);
ERROR
(
"Failed to enter netns of container"
);
_exit
(
-
1
);
}
...
...
@@ -84,7 +84,7 @@ static bool is_interface(const char *dev_name, pid_t pid)
/* Iterate through the interfaces */
for
(
tempIfAddr
=
interfaceArray
;
tempIfAddr
!=
NULL
;
tempIfAddr
=
tempIfAddr
->
ifa_next
)
{
if
(
!
strncmp
(
tempIfAddr
->
ifa_name
,
dev_name
,
strlen
(
tempIfAddr
->
ifa_name
))
)
if
(
strncmp
(
tempIfAddr
->
ifa_name
,
dev_name
,
strlen
(
tempIfAddr
->
ifa_name
))
==
0
)
_exit
(
EXIT_SUCCESS
);
}
...
...
@@ -147,7 +147,7 @@ int main(int argc, char *argv[])
}
if
(
!
c
->
is_running
(
c
))
{
ERROR
(
"Container %s is not running
.
"
,
c
->
name
);
ERROR
(
"Container %s is not running"
,
c
->
name
);
goto
err1
;
}
...
...
@@ -163,7 +163,7 @@ int main(int argc, char *argv[])
else
dst_name
=
my_args
.
argv
[
2
];
if
(
!
strncmp
(
cmd
,
"add"
,
strlen
(
cmd
))
)
{
if
(
strncmp
(
cmd
,
"add"
,
strlen
(
cmd
))
==
0
)
{
if
(
is_interface
(
dev_name
,
1
))
{
ret
=
c
->
attach_interface
(
c
,
dev_name
,
dst_name
);
}
else
{
...
...
@@ -171,10 +171,10 @@ int main(int argc, char *argv[])
}
if
(
ret
!=
true
)
{
ERROR
(
"Failed to add %s to %s
.
"
,
dev_name
,
c
->
name
);
ERROR
(
"Failed to add %s to %s"
,
dev_name
,
c
->
name
);
goto
err1
;
}
}
else
if
(
!
strncmp
(
cmd
,
"del"
,
strlen
(
cmd
))
)
{
}
else
if
(
strncmp
(
cmd
,
"del"
,
strlen
(
cmd
))
==
0
)
{
if
(
is_interface
(
dev_name
,
c
->
init_pid
(
c
)))
{
ret
=
c
->
detach_interface
(
c
,
dev_name
,
dst_name
);
}
else
{
...
...
@@ -182,7 +182,7 @@ int main(int argc, char *argv[])
}
if
(
ret
!=
true
)
{
ERROR
(
"Failed to del %s from %s
.
"
,
dev_name
,
c
->
name
);
ERROR
(
"Failed to del %s from %s"
,
dev_name
,
c
->
name
);
goto
err1
;
}
}
else
{
...
...
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