[lxc-devel] [lxc/master] conf: change some logs to print errno
2xsec on Github
lxc-bot at linuxcontainers.org
Tue Jun 5 05:45:28 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 403 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180605/92590ce7/attachment.bin>
-------------- next part --------------
From fea3b91d09cbf10f31991d674c0f0ba08a0f5fd5 Mon Sep 17 00:00:00 2001
From: Donghwa Jeong <dh48.jeong at samsung.com>
Date: Tue, 5 Jun 2018 14:43:48 +0900
Subject: [PATCH] conf: change some logs to print errno
Signed-off-by: Donghwa Jeong <dh48.jeong at samsung.com>
---
src/lxc/conf.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 48cd7f8b3..87674541f 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -3186,25 +3186,27 @@ void remount_all_slave(void)
char *line = NULL;
mntinfo_fd = open("/proc/self/mountinfo", O_RDONLY | O_CLOEXEC);
- if (mntinfo_fd < 0)
+ if (mntinfo_fd < 0) {
+ SYSERROR("Failed to open \"/proc/self/mountinfo\"");
return;
+ }
memfd = memfd_create(".lxc_mountinfo", MFD_CLOEXEC);
if (memfd < 0) {
char template[] = P_tmpdir "/.lxc_mountinfo_XXXXXX";
if (errno != ENOSYS) {
+ SYSERROR("Failed to create temporary in-memory file");
close(mntinfo_fd);
- WARN("Failed to create temporary in-memory file");
return;
}
memfd = lxc_make_tmpfile(template, true);
- }
- if (memfd < 0) {
- close(mntinfo_fd);
- WARN("Failed to create temporary file");
- return;
+ if (memfd < 0) {
+ close(mntinfo_fd);
+ WARN("Failed to create temporary file");
+ return;
+ }
}
#define __LXC_SENDFILE_MAX 0x7ffff000 /* maximum number of bytes sendfile can handle */
@@ -3214,9 +3216,9 @@ void remount_all_slave(void)
if (errno == EINTR)
goto again;
+ SYSERROR("Failed to copy \"/proc/self/mountinfo\"");
close(mntinfo_fd);
close(memfd);
- WARN("Failed to copy \"/proc/self/mountinfo\"");
return;
}
close(mntinfo_fd);
@@ -3226,15 +3228,15 @@ void remount_all_slave(void)
*/
ret = lseek(memfd, 0, SEEK_SET);
if (ret < 0) {
+ SYSERROR("Failed to reset file descriptor offset");
close(memfd);
- WARN("%s - Failed to reset file descriptor offset", strerror(errno));
return;
}
f = fdopen(memfd, "r");
if (!f) {
- WARN("Failed to open copy of \"/proc/self/mountinfo\" to mark "
- "all shared. Continuing");
+ SYSERROR("Failed to open copy of \"/proc/self/mountinfo\" to mark "
+ "all shared. Continuing");
close(memfd);
return;
}
More information about the lxc-devel
mailing list