]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: log failure to create tty mountpoint
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 3 Aug 2021 07:22:46 +0000 (09:22 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 3 Aug 2021 07:22:46 +0000 (09:22 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index 8dcfc60f3f84ff0af71509b73f0c7cbaec95f718..37104761e452fab40b7851568ac7a4a42e48a044 100644 (file)
@@ -946,11 +946,20 @@ static int open_ttymnt_at(int dfd, const char *path)
 {
        int fd;
 
-       fd = open_at(dfd, path, PROTECT_OPEN | O_CREAT | O_EXCL,
-                    PROTECT_LOOKUP_BENEATH, 0);
-       if (fd < 0 && (errno == ENXIO || errno == EEXIST))
-               fd = open_at(dfd, path, PROTECT_OPATH_FILE,
-                            PROTECT_LOOKUP_BENEATH, 0);
+       fd = open_at(dfd, path,
+                    PROTECT_OPEN | O_CREAT | O_EXCL,
+                    PROTECT_LOOKUP_BENEATH,
+                    0);
+       if (fd < 0) {
+               if (!IN_SET(errno, ENXIO, EEXIST))
+                       return syserror("Failed to create \"%d/\%s\"", dfd, path);
+
+               SYSINFO("Failed to create \"%d/\%s\"", dfd, path);
+               fd = open_at(dfd, path,
+                            PROTECT_OPATH_FILE,
+                            PROTECT_LOOKUP_BENEATH,
+                            0);
+       }
 
        return fd;
 }