From: Christian Brauner Date: Tue, 3 Aug 2021 07:22:46 +0000 (+0200) Subject: conf: log failure to create tty mountpoint X-Git-Tag: lxc-5.0.0~124^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=777827cb3a76ecab24131543c8a24f9b85f5cefd;p=thirdparty%2Flxc.git conf: log failure to create tty mountpoint Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 8dcfc60f3..37104761e 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -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; }