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
4efa4bb9
Commit
4efa4bb9
authored
Oct 29, 2016
by
Christian Brauner
Committed by
Stéphane Graber
Nov 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/lxc_autostart: use lxc_safe_{int,long}()
Signed-off-by:
Christian Brauner
<
christian.brauner@canonical.com
>
parent
3b56f032
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
9 deletions
+29
-9
lxc_autostart.c
src/lxc/tools/lxc_autostart.c
+29
-9
No files found.
src/lxc/tools/lxc_autostart.c
View file @
4efa4bb9
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include "arguments.h"
#include "arguments.h"
#include "list.h"
#include "list.h"
#include "log.h"
#include "log.h"
#include "utils.h"
lxc_log_define
(
lxc_autostart_ui
,
lxc
);
lxc_log_define
(
lxc_autostart_ui
,
lxc
);
static
struct
lxc_list
*
accumulate_list
(
char
*
input
,
char
*
delimiter
,
struct
lxc_list
*
str_list
);
static
struct
lxc_list
*
accumulate_list
(
char
*
input
,
char
*
delimiter
,
struct
lxc_list
*
str_list
);
...
@@ -35,14 +36,31 @@ struct lxc_list *cmd_groups_list = NULL;
...
@@ -35,14 +36,31 @@ struct lxc_list *cmd_groups_list = NULL;
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
)
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
)
{
{
switch
(
c
)
{
switch
(
c
)
{
case
'k'
:
args
->
hardstop
=
1
;
break
;
case
'k'
:
case
'L'
:
args
->
list
=
1
;
break
;
args
->
hardstop
=
1
;
case
'r'
:
args
->
reboot
=
1
;
break
;
break
;
case
's'
:
args
->
shutdown
=
1
;
break
;
case
'L'
:
case
'a'
:
args
->
all
=
1
;
break
;
args
->
list
=
1
;
case
'A'
:
args
->
ignore_auto
=
1
;
break
;
break
;
case
'g'
:
cmd_groups_list
=
accumulate_list
(
arg
,
","
,
cmd_groups_list
);
break
;
case
'r'
:
case
't'
:
args
->
timeout
=
atoi
(
arg
);
break
;
args
->
reboot
=
1
;
break
;
case
's'
:
args
->
shutdown
=
1
;
break
;
case
'a'
:
args
->
all
=
1
;
break
;
case
'A'
:
args
->
ignore_auto
=
1
;
break
;
case
'g'
:
cmd_groups_list
=
accumulate_list
(
arg
,
","
,
cmd_groups_list
);
break
;
case
't'
:
if
(
lxc_safe_long
(
arg
,
&
args
->
timeout
)
<
0
)
return
-
1
;
break
;
}
}
return
0
;
return
0
;
}
}
...
@@ -290,7 +308,9 @@ static int get_config_integer(struct lxc_container *c, char *key) {
...
@@ -290,7 +308,9 @@ static int get_config_integer(struct lxc_container *c, char *key) {
return
0
;
return
0
;
}
}
ret
=
atoi
(
value
);
if
(
lxc_safe_int
(
value
,
&
ret
)
<
0
)
DEBUG
(
"Could not parse config item."
);
free
(
value
);
free
(
value
);
return
ret
;
return
ret
;
...
...
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