mirror of
git://github.com/lxc/lxc
synced 2025-08-30 13:12:04 +00:00
utils: use lxc_safe_int()
Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
This commit is contained in:
parent
e8ec7c9efc
commit
2d036ccac0
@ -1766,7 +1766,7 @@ int mount_proc_if_needed(const char *rootfs)
|
|||||||
{
|
{
|
||||||
char path[MAXPATHLEN];
|
char path[MAXPATHLEN];
|
||||||
char link[20];
|
char link[20];
|
||||||
int linklen, ret;
|
int link_to_pid, linklen, ret;
|
||||||
int mypid;
|
int mypid;
|
||||||
|
|
||||||
ret = snprintf(path, MAXPATHLEN, "%s/proc/self", rootfs);
|
ret = snprintf(path, MAXPATHLEN, "%s/proc/self", rootfs);
|
||||||
@ -1785,7 +1785,9 @@ int mount_proc_if_needed(const char *rootfs)
|
|||||||
}
|
}
|
||||||
if (linklen < 0) /* /proc not mounted */
|
if (linklen < 0) /* /proc not mounted */
|
||||||
goto domount;
|
goto domount;
|
||||||
if (atoi(link) != mypid) {
|
if (lxc_safe_int(link, &link_to_pid) < 0)
|
||||||
|
return -1;
|
||||||
|
if (link_to_pid != mypid) {
|
||||||
/* wrong /procs mounted */
|
/* wrong /procs mounted */
|
||||||
umount2(path, MNT_DETACH); /* ignore failure */
|
umount2(path, MNT_DETACH); /* ignore failure */
|
||||||
goto domount;
|
goto domount;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user