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
1b9c9f5b
Unverified
Commit
1b9c9f5b
authored
Mar 09, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attach: use cleanup macros in lxc_attach_getpwshell()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
cf4026f1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
10 deletions
+5
-10
attach.c
src/lxc/attach.c
+5
-10
No files found.
src/lxc/attach.c
View file @
1b9c9f5b
...
@@ -365,14 +365,13 @@ static int lxc_attach_set_environment(struct lxc_proc_context_info *init_ctx,
...
@@ -365,14 +365,13 @@ static int lxc_attach_set_environment(struct lxc_proc_context_info *init_ctx,
static
char
*
lxc_attach_getpwshell
(
uid_t
uid
)
static
char
*
lxc_attach_getpwshell
(
uid_t
uid
)
{
{
__do_free
char
*
line
=
NULL
;
__do_free
char
*
line
=
NULL
,
*
result
=
NULL
;
__do_fclose
FILE
*
pipe_f
=
NULL
;
__do_fclose
FILE
*
pipe_f
=
NULL
;
int
fd
,
ret
;
int
fd
,
ret
;
pid_t
pid
;
pid_t
pid
;
int
pipes
[
2
];
int
pipes
[
2
];
bool
found
=
false
;
bool
found
=
false
;
size_t
line_bufsz
=
0
;
size_t
line_bufsz
=
0
;
char
*
result
=
NULL
;
/* We need to fork off a process that runs the getent program, and we
/* We need to fork off a process that runs the getent program, and we
* need to capture its output, so we use a pipe for that purpose.
* need to capture its output, so we use a pipe for that purpose.
...
@@ -489,7 +488,7 @@ static char *lxc_attach_getpwshell(uid_t uid)
...
@@ -489,7 +488,7 @@ static char *lxc_attach_getpwshell(uid_t uid)
if
(
!
token
)
if
(
!
token
)
continue
;
continue
;
free
(
result
);
free
_disarm
(
result
);
result
=
strdup
(
token
);
result
=
strdup
(
token
);
/* Sanity check that there are no fields after that. */
/* Sanity check that there are no fields after that. */
...
@@ -502,17 +501,13 @@ static char *lxc_attach_getpwshell(uid_t uid)
...
@@ -502,17 +501,13 @@ static char *lxc_attach_getpwshell(uid_t uid)
reap_child:
reap_child:
ret
=
wait_for_pid
(
pid
);
ret
=
wait_for_pid
(
pid
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
free
(
result
);
return
NULL
;
return
NULL
;
}
if
(
!
found
)
{
if
(
!
found
)
free
(
result
);
return
NULL
;
return
NULL
;
}
return
result
;
return
move_ptr
(
result
)
;
}
}
static
void
lxc_attach_get_init_uidgid
(
uid_t
*
init_uid
,
gid_t
*
init_gid
)
static
void
lxc_attach_get_init_uidgid
(
uid_t
*
init_uid
,
gid_t
*
init_gid
)
...
...
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