From: Christian Brauner Date: Fri, 15 Jun 2018 11:34:04 +0000 (+0200) Subject: coverity: #1425748 X-Git-Tag: lxc-3.1.0~244^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77f948545c2a6030fb872bec115aee24586046d4;p=thirdparty%2Flxc.git coverity: #1425748 Time of check time of use Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 938762551..f3feae7df 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -1541,16 +1541,11 @@ static int lxc_setup_devpts(struct lxc_conf *conf) if (ret < 0 || (size_t)ret >= sizeof(devpts_mntopts)) return -1; - /* Unmount old devpts instance. */ - ret = access("/dev/pts/ptmx", F_OK); - if (!ret) { - ret = umount("/dev/pts"); - if (ret < 0) { - SYSERROR("Failed to unmount old devpts instance"); - return -1; - } + ret = umount2("/dev/pts", MNT_DETACH); + if (ret < 0) + WARN("%s - Failed to unmount old devpts instance", strerror(errno)); + else DEBUG("Unmounted old devpts instance"); - } /* Create mountpoint for devpts instance. */ ret = mkdir("/dev/pts", 0755);