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
501cbc71
Commit
501cbc71
authored
Apr 29, 2010
by
Michel Normand
Committed by
Daniel Lezcano
Apr 29, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
report error if statefd parm is not a digit
Signed-off-by:
Michel Normand
<
normand@fr.ibm.com
>
Signed-off-by:
Daniel Lezcano
<
dlezcano@fr.ibm.com
>
parent
883a8168
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
16 deletions
+31
-16
arguments.c
src/lxc/arguments.c
+20
-0
arguments.h
src/lxc/arguments.h
+1
-0
lxc_checkpoint.c
src/lxc/lxc_checkpoint.c
+5
-8
lxc_restart.c
src/lxc/lxc_restart.c
+5
-8
No files found.
src/lxc/arguments.c
View file @
501cbc71
...
...
@@ -230,3 +230,23 @@ extern char **lxc_arguments_dup(const char *file, struct lxc_arguments *args)
return
argv
;
}
int
lxc_arguments_str_to_int
(
struct
lxc_arguments
*
args
,
const
char
*
str
)
{
long
val
;
char
*
endptr
;
errno
=
0
;
val
=
strtol
(
str
,
&
endptr
,
10
);
if
(
errno
)
{
lxc_error
(
args
,
"invalid statefd '%s' : %m"
,
str
);
return
-
1
;
}
if
(
*
endptr
)
{
lxc_error
(
args
,
"invalid digit for statefd '%s'"
,
str
);
return
-
1
;
}
return
(
int
)
val
;
}
src/lxc/arguments.h
View file @
501cbc71
...
...
@@ -78,6 +78,7 @@ extern int lxc_arguments_parse(struct lxc_arguments *args,
int
argc
,
char
*
const
argv
[]);
extern
char
**
lxc_arguments_dup
(
const
char
*
file
,
struct
lxc_arguments
*
args
);
extern
int
lxc_arguments_str_to_int
(
struct
lxc_arguments
*
args
,
const
char
*
str
);
extern
const
char
*
lxc_strerror
(
int
errnum
);
...
...
src/lxc/lxc_checkpoint.c
View file @
501cbc71
...
...
@@ -60,15 +60,12 @@ static int my_parser(struct lxc_arguments* args, int c, char* arg)
case
'p'
:
args
->
flags
=
LXC_FLAG_PAUSE
;
break
;
case
'S'
:
args
->
statefile
=
arg
;
break
;
case
'd'
:
{
long
val
;
errno
=
0
;
val
=
strtol
(
arg
,
(
char
**
)
NULL
,
10
);
if
(
errno
)
{
lxc_error
(
args
,
"invalid statefd '%s' : %m
\n
"
,
arg
);
int
fd
;
fd
=
lxc_arguments_str_to_int
(
args
,
arg
);
if
(
fd
<
0
)
return
-
1
;
}
args
->
statefd
=
(
int
)
val
;
args
->
statefd
=
fd
;
break
;
}
}
...
...
src/lxc/lxc_restart.c
View file @
501cbc71
...
...
@@ -63,15 +63,12 @@ static int my_parser(struct lxc_arguments* args, int c, char* arg)
case
'p'
:
args
->
flags
=
LXC_FLAG_PAUSE
;
break
;
case
's'
:
return
lxc_config_define_add
(
&
defines
,
arg
);
case
'd'
:
{
long
val
;
errno
=
0
;
val
=
strtol
(
arg
,
(
char
**
)
NULL
,
10
);
if
(
errno
)
{
lxc_error
(
args
,
"invalid statefd '%s' : %m
\n
"
,
arg
);
int
fd
;
fd
=
lxc_arguments_str_to_int
(
args
,
arg
);
if
(
fd
<
0
)
return
-
1
;
}
args
->
statefd
=
(
int
)
val
;
args
->
statefd
=
fd
;
break
;
}
}
...
...
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