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
7f830613
Commit
7f830613
authored
May 18, 2009
by
Michel Normand
Committed by
Daniel Lezcano
May 18, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxc-create to return 255 in case of error
to have same exit code for all lxc commands Signed-off-by:
Michel Normand
<
normand@fr.ibm.com
>
Signed-off-by:
Daniel Lezcano
<
dlezcano@fr.ibm.com
>
parent
23075e69
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
22 deletions
+14
-22
create.c
src/lxc/create.c
+9
-13
lxc_create.c
src/lxc/lxc_create.c
+5
-9
No files found.
src/lxc/create.c
View file @
7f830613
...
...
@@ -61,14 +61,14 @@ static int create_lxc_directory(const char *dirname)
if
(
mkdir
(
LXCPATH
,
0755
)
&&
errno
!=
EEXIST
)
{
SYSERROR
(
"failed to create %s directory"
,
LXCPATH
);
return
-
errno
;
return
-
1
;
}
s
printf
(
path
,
LXCPATH
"/%s"
,
dirname
);
s
nprintf
(
path
,
MAXPATHLEN
,
LXCPATH
"/%s"
,
dirname
);
if
(
mkdir
(
path
,
0755
))
{
SYSERROR
(
"failed to create %s directory"
,
path
);
return
-
errno
;
return
-
1
;
}
return
0
;
...
...
@@ -78,7 +78,7 @@ static int remove_lxc_directory(const char *dirname)
{
char
path
[
MAXPATHLEN
];
s
printf
(
path
,
LXCPATH
"/%s"
,
dirname
);
s
nprintf
(
path
,
MAXPATHLEN
,
LXCPATH
"/%s"
,
dirname
);
if
(
rmdir
(
path
))
{
SYSERROR
(
"failed to remove %s directory"
,
path
);
...
...
@@ -97,18 +97,15 @@ static int remove_lxc_directory(const char *dirname)
int
lxc_create
(
const
char
*
name
,
struct
lxc_conf
*
conf
)
{
int
lock
,
err
;
int
lock
,
err
=
-
1
;
err
=
create_lxc_directory
(
name
);
if
(
err
<
0
)
return
err
==
-
EEXIST
?
-
LXC_ERROR_EEXIST
:
LXC_ERROR_INTERNAL
;
if
(
create_lxc_directory
(
name
))
return
err
;
lock
=
lxc_get_lock
(
name
);
if
(
lock
<
0
)
return
-
LXC_ERROR_LOCK
;
return
err
;
err
=
LXC_ERROR_INTERNAL
;
if
(
lxc_mkstate
(
name
))
{
ERROR
(
"failed to create the state file for %s"
,
name
);
goto
err
;
...
...
@@ -119,8 +116,7 @@ int lxc_create(const char *name, struct lxc_conf *conf)
goto
err_state
;
}
err
=
lxc_configure
(
name
,
conf
);
if
(
err
)
{
if
(
lxc_configure
(
name
,
conf
))
{
ERROR
(
"failed to set configuration for %s"
,
name
);
goto
err_state
;
}
...
...
src/lxc/lxc_create.c
View file @
7f830613
...
...
@@ -70,22 +70,18 @@ int main(int argc, char *argv[])
ret
=
lxc_arguments_parse
(
&
my_args
,
argc
,
argv
);
if
(
ret
)
return
1
;
return
-
1
;
if
(
lxc_log_init
(
my_args
.
log_file
,
my_args
.
log_priority
,
my_args
.
progname
,
my_args
.
quiet
))
return
1
;
return
-
1
;
if
(
lxc_conf_init
(
&
lxc_conf
))
return
1
;
return
-
1
;
if
(
my_args
.
rcfile
&&
lxc_config_read
(
my_args
.
rcfile
,
&
lxc_conf
))
return
1
;
return
-
1
;
ret
=
lxc_create
(
my_args
.
name
,
&
lxc_conf
);
if
(
ret
)
return
1
;
return
0
;
return
lxc_create
(
my_args
.
name
,
&
lxc_conf
);
}
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