[CRIU] [PATCH] fsnotify: Print error if link can't be read
Cyrill Gorcunov
gorcunov at openvz.org
Fri Oct 11 08:21:56 PDT 2013
On some machine, where fsnotify failed to restore
due to different reason, readlink fails as well, so
print
| (01.115708) 244: Error (fsnotify.c:220): fsnotify: Can't read link for /proc/self/fd/7: Permission denied
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
fsnotify.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fsnotify.c b/fsnotify.c
index e0f59b9..784c416 100644
--- a/fsnotify.c
+++ b/fsnotify.c
@@ -216,8 +216,11 @@ static char *get_mark_path(const char *who, struct file_remap *remap,
if (log_get_loglevel() >= LOG_DEBUG) {
memzero(link, sizeof(link));
- readlink(path, link, sizeof(link));
- link[sizeof(link) - 1] = '\0';
+ if (readlink(path, link, sizeof(link)) < 0) {
+ pr_perror("Can't read link for %s", path);
+ link[0] = '\0';
+ } else
+ link[sizeof(link) - 1] = '\0';
} else
link[0] = '\0';
--
1.8.3.1
More information about the CRIU
mailing list