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
a2c26bef
Unverified
Commit
a2c26bef
authored
Nov 05, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attach: silence stdio permission adjust warnings
Closes: #3576. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
056b6a60
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
attach.c
src/lxc/attach.c
+1
-1
utils.c
src/lxc/utils.c
+6
-5
No files found.
src/lxc/attach.c
View file @
a2c26bef
...
@@ -883,7 +883,7 @@ static int attach_child_main(struct attach_clone_payload *payload)
...
@@ -883,7 +883,7 @@ static int attach_child_main(struct attach_clone_payload *payload)
/* Make sure that the processes STDIO is correctly owned by the user that we are switching to */
/* Make sure that the processes STDIO is correctly owned by the user that we are switching to */
ret
=
fix_stdio_permissions
(
new_uid
);
ret
=
fix_stdio_permissions
(
new_uid
);
if
(
ret
)
if
(
ret
)
WARN
(
"Failed to adjust stdio permissions"
);
INFO
(
"Failed to adjust stdio permissions"
);
if
(
!
lxc_switch_uid_gid
(
new_uid
,
new_gid
))
if
(
!
lxc_switch_uid_gid
(
new_uid
,
new_gid
))
goto
on_error
;
goto
on_error
;
...
...
src/lxc/utils.c
View file @
a2c26bef
...
@@ -1885,11 +1885,11 @@ int fix_stdio_permissions(uid_t uid)
...
@@ -1885,11 +1885,11 @@ int fix_stdio_permissions(uid_t uid)
devnull_fd
=
open_devnull
();
devnull_fd
=
open_devnull
();
if
(
devnull_fd
<
0
)
if
(
devnull_fd
<
0
)
return
log_
warn
_errno
(
-
1
,
errno
,
"Failed to open
\"
/dev/null
\"
"
);
return
log_
trace
_errno
(
-
1
,
errno
,
"Failed to open
\"
/dev/null
\"
"
);
ret
=
fstat
(
devnull_fd
,
&
st_null
);
ret
=
fstat
(
devnull_fd
,
&
st_null
);
if
(
ret
)
if
(
ret
)
return
log_
warn
_errno
(
-
errno
,
errno
,
"Failed to stat
\"
/dev/null
\"
"
);
return
log_
trace
_errno
(
-
errno
,
errno
,
"Failed to stat
\"
/dev/null
\"
"
);
for
(
int
i
=
0
;
i
<
ARRAY_SIZE
(
std_fds
);
i
++
)
{
for
(
int
i
=
0
;
i
<
ARRAY_SIZE
(
std_fds
);
i
++
)
{
ret
=
fstat
(
std_fds
[
i
],
&
st
);
ret
=
fstat
(
std_fds
[
i
],
&
st
);
...
@@ -1904,14 +1904,15 @@ int fix_stdio_permissions(uid_t uid)
...
@@ -1904,14 +1904,15 @@ int fix_stdio_permissions(uid_t uid)
ret
=
fchown
(
std_fds
[
i
],
uid
,
st
.
st_gid
);
ret
=
fchown
(
std_fds
[
i
],
uid
,
st
.
st_gid
);
if
(
ret
)
{
if
(
ret
)
{
SYSWARN
(
"Failed to chown standard I/O file descriptor %d to uid %d and gid %d"
,
TRACE
(
"Failed to chown standard I/O file descriptor %d to uid %d and gid %d"
,
std_fds
[
i
],
uid
,
st
.
st_gid
);
std_fds
[
i
],
uid
,
st
.
st_gid
);
fret
=
-
1
;
fret
=
-
1
;
continue
;
}
}
ret
=
fchmod
(
std_fds
[
i
],
0700
);
ret
=
fchmod
(
std_fds
[
i
],
0700
);
if
(
ret
)
{
if
(
ret
)
{
SYSWARN
(
"Failed to chmod standard I/O file descriptor %d"
,
std_fds
[
i
]);
TRACE
(
"Failed to chmod standard I/O file descriptor %d"
,
std_fds
[
i
]);
fret
=
-
1
;
fret
=
-
1
;
}
}
}
}
...
...
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