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
fad6ef95
Commit
fad6ef95
authored
Dec 10, 2016
by
Wolfgang Bumiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf, attach: save errno across call to close
Save errno across some calls to close() since it can be interrupted. Signed-off-by:
Wolfgang Bumiller
<
wry.git@bumiller.com
>
parent
f1f9cbf2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
attach.c
src/lxc/attach.c
+3
-2
conf.c
src/lxc/conf.c
+5
-3
No files found.
src/lxc/attach.c
View file @
fad6ef95
...
@@ -972,7 +972,7 @@ int lxc_attach(const char* name, const char* lxcpath, lxc_attach_exec_t exec_fun
...
@@ -972,7 +972,7 @@ int lxc_attach(const char* name, const char* lxcpath, lxc_attach_exec_t exec_fun
/* Open LSM fd and send it to child. */
/* Open LSM fd and send it to child. */
if
((
options
->
namespaces
&
CLONE_NEWNS
)
&&
(
options
->
attach_flags
&
LXC_ATTACH_LSM
)
&&
init_ctx
->
lsm_label
)
{
if
((
options
->
namespaces
&
CLONE_NEWNS
)
&&
(
options
->
attach_flags
&
LXC_ATTACH_LSM
)
&&
init_ctx
->
lsm_label
)
{
int
on_exec
;
int
on_exec
,
saved_errno
;
int
labelfd
=
-
1
;
int
labelfd
=
-
1
;
on_exec
=
options
->
attach_flags
&
LXC_ATTACH_LSM_EXEC
?
1
:
0
;
on_exec
=
options
->
attach_flags
&
LXC_ATTACH_LSM_EXEC
?
1
:
0
;
/* Open fd for the LSM security module. */
/* Open fd for the LSM security module. */
...
@@ -982,9 +982,10 @@ int lxc_attach(const char* name, const char* lxcpath, lxc_attach_exec_t exec_fun
...
@@ -982,9 +982,10 @@ int lxc_attach(const char* name, const char* lxcpath, lxc_attach_exec_t exec_fun
/* Send child fd of the LSM security module to write to. */
/* Send child fd of the LSM security module to write to. */
ret
=
lxc_abstract_unix_send_fd
(
ipc_sockets
[
0
],
labelfd
,
NULL
,
0
);
ret
=
lxc_abstract_unix_send_fd
(
ipc_sockets
[
0
],
labelfd
,
NULL
,
0
);
saved_errno
=
errno
;
close
(
labelfd
);
close
(
labelfd
);
if
(
ret
<=
0
)
{
if
(
ret
<=
0
)
{
ERROR
(
"Intended to send file descriptor %d: %s."
,
labelfd
,
strerror
(
errno
));
ERROR
(
"Intended to send file descriptor %d: %s."
,
labelfd
,
strerror
(
saved_
errno
));
goto
on_error
;
goto
on_error
;
}
}
}
}
...
...
src/lxc/conf.c
View file @
fad6ef95
...
@@ -2018,9 +2018,10 @@ FILE *make_anonymous_mount_file(struct lxc_list *mount)
...
@@ -2018,9 +2018,10 @@ FILE *make_anonymous_mount_file(struct lxc_list *mount)
}
}
if
(
!
file
)
{
if
(
!
file
)
{
int
saved_errno
=
errno
;
if
(
fd
!=
-
1
)
if
(
fd
!=
-
1
)
close
(
fd
);
close
(
fd
);
ERROR
(
"Could not create mount entry file: %s."
,
strerror
(
errno
));
ERROR
(
"Could not create mount entry file: %s."
,
strerror
(
saved_
errno
));
return
NULL
;
return
NULL
;
}
}
...
@@ -2188,7 +2189,7 @@ static int setup_hw_addr(char *hwaddr, const char *ifname)
...
@@ -2188,7 +2189,7 @@ static int setup_hw_addr(char *hwaddr, const char *ifname)
{
{
struct
sockaddr
sockaddr
;
struct
sockaddr
sockaddr
;
struct
ifreq
ifr
;
struct
ifreq
ifr
;
int
ret
,
fd
;
int
ret
,
fd
,
saved_errno
;
ret
=
lxc_convert_mac
(
hwaddr
,
&
sockaddr
);
ret
=
lxc_convert_mac
(
hwaddr
,
&
sockaddr
);
if
(
ret
)
{
if
(
ret
)
{
...
@@ -2208,9 +2209,10 @@ static int setup_hw_addr(char *hwaddr, const char *ifname)
...
@@ -2208,9 +2209,10 @@ static int setup_hw_addr(char *hwaddr, const char *ifname)
}
}
ret
=
ioctl
(
fd
,
SIOCSIFHWADDR
,
&
ifr
);
ret
=
ioctl
(
fd
,
SIOCSIFHWADDR
,
&
ifr
);
saved_errno
=
errno
;
close
(
fd
);
close
(
fd
);
if
(
ret
)
if
(
ret
)
ERROR
(
"ioctl failure : %s"
,
strerror
(
errno
));
ERROR
(
"ioctl failure : %s"
,
strerror
(
saved_
errno
));
DEBUG
(
"mac address '%s' on '%s' has been setup"
,
hwaddr
,
ifr
.
ifr_name
);
DEBUG
(
"mac address '%s' on '%s' has been setup"
,
hwaddr
,
ifr
.
ifr_name
);
...
...
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