From: Christian Brauner Date: Thu, 14 Jun 2018 19:56:52 +0000 (+0200) Subject: coverity: #1425748 X-Git-Tag: lxc-3.1.0~247^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b29e05d62973511aa6aed81f2787b6c451a3f43b;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 d4a16cd2b..6bcbe38cc 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -1581,13 +1581,13 @@ static int lxc_setup_devpts(struct lxc_conf *conf) DEBUG("Mount new devpts instance with options \"%s\"", devpts_mntopts); /* Remove any pre-existing /dev/ptmx file. */ - ret = access("/dev/ptmx", F_OK); - if (!ret) { - ret = remove("/dev/ptmx"); - if (ret < 0) { + ret = remove("/dev/ptmx"); + if (ret < 0) { + if (errno != ENOENT) { SYSERROR("Failed to remove existing \"/dev/ptmx\" file"); return -1; } + } else { DEBUG("Removed existing \"/dev/ptmx\" file"); }