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
e0cb8f4e
Unverified
Commit
e0cb8f4e
authored
Feb 09, 2019
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxc-usernsexec: use cleanup macros
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
55236d5d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
17 deletions
+10
-17
Makefile.am
src/lxc/Makefile.am
+2
-1
lxc_usernsexec.c
src/lxc/cmd/lxc_usernsexec.c
+8
-16
No files found.
src/lxc/Makefile.am
View file @
e0cb8f4e
...
...
@@ -375,10 +375,11 @@ lxc_user_nic_SOURCES = cmd/lxc_user_nic.c \
syscall_wrappers.h
lxc_usernsexec_SOURCES
=
cmd/lxc_usernsexec.c
\
conf.c conf.h
\
file_utils.c file_utils.h
\
list.h
\
log.c log.h
\
macro.h
\
file_utils.c file
_utils.h
\
memory
_utils.h
\
string_utils.c string_utils.h
\
syscall_wrappers.h
\
utils.c utils.h
...
...
src/lxc/cmd/lxc_usernsexec.c
View file @
e0cb8f4e
...
...
@@ -47,6 +47,7 @@
#include "list.h"
#include "log.h"
#include "macro.h"
#include "memory_utils.h"
#include "file_utils.h"
#include "string_utils.h"
#include "syscall_wrappers.h"
...
...
@@ -198,13 +199,13 @@ static int parse_map(char *map)
*/
static
int
read_default_map
(
char
*
fnam
,
int
which
,
char
*
user
)
{
__do_free
char
*
line
=
NULL
;
__do_fclose
FILE
*
fin
=
NULL
;
size_t
len
;
char
*
p1
,
*
p2
;
unsigned
long
ul1
,
ul2
;
FILE
*
fin
;
int
ret
=
-
1
;
size_t
sz
=
0
;
char
*
line
=
NULL
;
struct
lxc_list
*
tmp
=
NULL
;
struct
id_map
*
newmap
=
NULL
;
...
...
@@ -259,16 +260,13 @@ static int read_default_map(char *fnam, int which, char *user)
break
;
}
fclose
(
fin
);
free
(
line
);
return
ret
;
}
static
int
find_default_map
(
void
)
{
__do_free
char
*
buf
=
NULL
;
size_t
bufsize
;
char
*
buf
;
struct
passwd
pwent
;
int
ret
=
-
1
;
struct
passwd
*
pwentp
=
NULL
;
...
...
@@ -287,24 +285,18 @@ static int find_default_map(void)
CMD_SYSERROR
(
"Failed to find matched password record"
);
CMD_SYSERROR
(
"Failed to get password record for uid %d"
,
getuid
());
ret
=
-
1
;
goto
out
;
return
-
1
;
}
ret
=
read_default_map
(
subuidfile
,
ID_TYPE_UID
,
pwent
.
pw_name
);
if
(
ret
<
0
)
goto
out
;
return
-
1
;
ret
=
read_default_map
(
subgidfile
,
ID_TYPE_GID
,
pwent
.
pw_name
);
if
(
ret
<
0
)
goto
out
;
ret
=
0
;
out:
free
(
buf
);
return
-
1
;
return
ret
;
return
0
;
}
int
main
(
int
argc
,
char
*
argv
[])
...
...
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