From eb4a75afd97ef1d746373c751deb6857a13111a0 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 29 May 2018 12:41:48 +0200 Subject: [PATCH] lib/path: improve debug message on redirect Signed-off-by: Karel Zak --- lib/path.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/path.c b/lib/path.c index d35262b891..cfc1c23725 100644 --- a/lib/path.c +++ b/lib/path.c @@ -274,7 +274,6 @@ int ul_path_access(struct path_cxt *pc, int mode, const char *path) && pc->redirect_on_enoent && pc->redirect_on_enoent(pc, path, &dir) == 0) rc = faccessat(dir, path, mode, 0); - return rc; } @@ -298,18 +297,19 @@ int ul_path_open(struct path_cxt *pc, int flags, const char *path) fd = open(path, flags); DBG(CXT, ul_debug("opening '%s'", path)); } else { + int fdx; int dir = ul_path_get_dirfd(pc); if (dir < 0) return dir; - fd = openat(dir, path, flags); + fdx = fd = openat(dir, path, flags); if (fd < 0 && errno == ENOENT && pc->redirect_on_enoent && pc->redirect_on_enoent(pc, path, &dir) == 0) fd = openat(dir, path, flags); - DBG(CXT, ul_debugobj(pc, "opening '%s'", path)); + DBG(CXT, ul_debugobj(pc, "opening '%s'%s", path, fdx != fd ? " [redirected]" : "")); } return fd; } -- 2.47.2