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
a16657ff
Unverified
Commit
a16657ff
authored
Aug 25, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: s/LXC_NUMSTRLEN64/INTTYPE_TO_STRLEN()/
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
b270f2ee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
network.c
src/lxc/network.c
+8
-7
No files found.
src/lxc/network.c
View file @
a16657ff
...
@@ -49,6 +49,7 @@
...
@@ -49,6 +49,7 @@
#include "conf.h"
#include "conf.h"
#include "config.h"
#include "config.h"
#include "log.h"
#include "log.h"
#include "macro.h"
#include "network.h"
#include "network.h"
#include "nl.h"
#include "nl.h"
#include "utils.h"
#include "utils.h"
...
@@ -2102,7 +2103,7 @@ static int lxc_create_network_unpriv_exec(const char *lxcpath, const char *lxcna
...
@@ -2102,7 +2103,7 @@ static int lxc_create_network_unpriv_exec(const char *lxcpath, const char *lxcna
if
(
child
==
0
)
{
if
(
child
==
0
)
{
int
ret
;
int
ret
;
size_t
retlen
;
size_t
retlen
;
char
pidstr
[
LXC_NUMSTRLEN64
];
char
pidstr
[
INTTYPE_TO_STRLEN
(
pid_t
)
];
close
(
pipefd
[
0
]);
close
(
pipefd
[
0
]);
...
@@ -2124,10 +2125,10 @@ static int lxc_create_network_unpriv_exec(const char *lxcpath, const char *lxcna
...
@@ -2124,10 +2125,10 @@ static int lxc_create_network_unpriv_exec(const char *lxcpath, const char *lxcna
_exit
(
EXIT_FAILURE
);
_exit
(
EXIT_FAILURE
);
}
}
ret
=
snprintf
(
pidstr
,
LXC_NUMSTRLEN64
,
"%d"
,
pid
);
ret
=
snprintf
(
pidstr
,
sizeof
(
pidstr
)
,
"%d"
,
pid
);
if
(
ret
<
0
||
ret
>=
LXC_NUMSTRLEN64
)
if
(
ret
<
0
||
ret
>=
sizeof
(
pidstr
)
)
_exit
(
EXIT_FAILURE
);
_exit
(
EXIT_FAILURE
);
pidstr
[
LXC_NUMSTRLEN64
-
1
]
=
'\0'
;
pidstr
[
sizeof
(
pidstr
)
-
1
]
=
'\0'
;
INFO
(
"Execing lxc-user-nic create %s %s %s veth %s %s"
,
lxcpath
,
INFO
(
"Execing lxc-user-nic create %s %s %s veth %s %s"
,
lxcpath
,
lxcname
,
pidstr
,
netdev_link
,
lxcname
,
pidstr
,
netdev_link
,
...
@@ -2329,15 +2330,15 @@ bool lxc_delete_network_unpriv(struct lxc_handler *handler)
...
@@ -2329,15 +2330,15 @@ bool lxc_delete_network_unpriv(struct lxc_handler *handler)
struct
lxc_list
*
network
=
&
handler
->
conf
->
network
;
struct
lxc_list
*
network
=
&
handler
->
conf
->
network
;
/* strlen("/proc/") = 6
/* strlen("/proc/") = 6
* +
* +
*
LXC_NUMSTRLEN64
*
INTTYPE_TO_STRLEN(pid_t)
* +
* +
* strlen("/fd/") = 4
* strlen("/fd/") = 4
* +
* +
*
LXC_NUMSTRLEN64
*
INTTYPE_TO_STRLEN(int)
* +
* +
* \0
* \0
*/
*/
char
netns_path
[
6
+
LXC_NUMSTRLEN64
+
4
+
LXC_NUMSTRLEN64
+
1
];
char
netns_path
[
6
+
INTTYPE_TO_STRLEN
(
pid_t
)
+
4
+
INTTYPE_TO_STRLEN
(
int
)
+
1
];
*
netns_path
=
'\0'
;
*
netns_path
=
'\0'
;
...
...
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