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
2f443e88
Unverified
Commit
2f443e88
authored
Feb 05, 2019
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: remove stack allocations
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
fdcdb654
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
conf.c
src/lxc/conf.c
+8
-5
No files found.
src/lxc/conf.c
View file @
2f443e88
...
@@ -67,6 +67,7 @@
...
@@ -67,6 +67,7 @@
#include "lxclock.h"
#include "lxclock.h"
#include "lxcseccomp.h"
#include "lxcseccomp.h"
#include "macro.h"
#include "macro.h"
#include "memory_utils.h"
#include "namespace.h"
#include "namespace.h"
#include "network.h"
#include "network.h"
#include "parse.h"
#include "parse.h"
...
@@ -486,8 +487,9 @@ on_error:
...
@@ -486,8 +487,9 @@ on_error:
int
run_script
(
const
char
*
name
,
const
char
*
section
,
const
char
*
script
,
...)
int
run_script
(
const
char
*
name
,
const
char
*
section
,
const
char
*
script
,
...)
{
{
__do_free
char
*
buffer
=
NULL
;
int
ret
;
int
ret
;
char
*
buffer
,
*
p
;
char
*
p
;
va_list
ap
;
va_list
ap
;
size_t
size
=
0
;
size_t
size
=
0
;
...
@@ -508,7 +510,7 @@ int run_script(const char *name, const char *section, const char *script, ...)
...
@@ -508,7 +510,7 @@ int run_script(const char *name, const char *section, const char *script, ...)
if
(
size
>
INT_MAX
)
if
(
size
>
INT_MAX
)
return
-
1
;
return
-
1
;
buffer
=
alloca
(
size
);
buffer
=
must_realloc
(
NULL
,
size
);
ret
=
snprintf
(
buffer
,
size
,
"exec %s %s %s"
,
script
,
name
,
section
);
ret
=
snprintf
(
buffer
,
size
,
"exec %s %s %s"
,
script
,
name
,
section
);
if
(
ret
<
0
||
ret
>=
size
)
if
(
ret
<
0
||
ret
>=
size
)
return
-
1
;
return
-
1
;
...
@@ -1136,16 +1138,16 @@ on_error:
...
@@ -1136,16 +1138,16 @@ on_error:
static
int
mount_autodev
(
const
char
*
name
,
const
struct
lxc_rootfs
*
rootfs
,
static
int
mount_autodev
(
const
char
*
name
,
const
struct
lxc_rootfs
*
rootfs
,
const
char
*
lxcpath
)
const
char
*
lxcpath
)
{
{
__do_free
char
*
path
=
NULL
;
int
ret
;
int
ret
;
size_t
clen
;
size_t
clen
;
char
*
path
;
mode_t
cur_mask
;
mode_t
cur_mask
;
INFO
(
"Preparing
\"
/dev
\"
"
);
INFO
(
"Preparing
\"
/dev
\"
"
);
/* $(rootfs->mount) + "/dev/pts" + '\0' */
/* $(rootfs->mount) + "/dev/pts" + '\0' */
clen
=
(
rootfs
->
path
?
strlen
(
rootfs
->
mount
)
:
0
)
+
9
;
clen
=
(
rootfs
->
path
?
strlen
(
rootfs
->
mount
)
:
0
)
+
9
;
path
=
alloca
(
clen
);
path
=
must_realloc
(
NULL
,
clen
);
ret
=
snprintf
(
path
,
clen
,
"%s/dev"
,
rootfs
->
path
?
rootfs
->
mount
:
""
);
ret
=
snprintf
(
path
,
clen
,
"%s/dev"
,
rootfs
->
path
?
rootfs
->
mount
:
""
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
clen
)
if
(
ret
<
0
||
(
size_t
)
ret
>=
clen
)
...
@@ -2560,6 +2562,7 @@ static int setup_caps(struct lxc_list *caps)
...
@@ -2560,6 +2562,7 @@ static int setup_caps(struct lxc_list *caps)
static
int
dropcaps_except
(
struct
lxc_list
*
caps
)
static
int
dropcaps_except
(
struct
lxc_list
*
caps
)
{
{
__do_free
int
*
caplist
=
NULL
;
int
i
,
capid
,
numcaps
;
int
i
,
capid
,
numcaps
;
char
*
keep_entry
;
char
*
keep_entry
;
struct
lxc_list
*
iterator
;
struct
lxc_list
*
iterator
;
...
@@ -2570,7 +2573,7 @@ static int dropcaps_except(struct lxc_list *caps)
...
@@ -2570,7 +2573,7 @@ static int dropcaps_except(struct lxc_list *caps)
TRACE
(
"Found %d capabilities"
,
numcaps
);
TRACE
(
"Found %d capabilities"
,
numcaps
);
/* caplist[i] is 1 if we keep capability i */
/* caplist[i] is 1 if we keep capability i */
int
*
caplist
=
alloca
(
numcaps
*
sizeof
(
int
));
caplist
=
must_realloc
(
NULL
,
numcaps
*
sizeof
(
int
));
memset
(
caplist
,
0
,
numcaps
*
sizeof
(
int
));
memset
(
caplist
,
0
,
numcaps
*
sizeof
(
int
));
lxc_list_for_each
(
iterator
,
caps
)
{
lxc_list_for_each
(
iterator
,
caps
)
{
...
...
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