]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: #1425748
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 14 Jun 2018 19:56:52 +0000 (21:56 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 14 Jun 2018 19:56:52 +0000 (21:56 +0200)
Time of check time of use

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index d4a16cd2bfc8d0bcf64f24035a5555baadbfa3e0..6bcbe38cca45c89a83a0d25c19b696d017a52cd7 100644 (file)
@@ -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");
        }