From: Karel Zak Date: Tue, 29 May 2018 10:41:48 +0000 (+0200) Subject: lib/path: improve debug message on redirect X-Git-Tag: v2.33-rc1~174 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb4a75afd97ef1d746373c751deb6857a13111a0;p=thirdparty%2Futil-linux.git lib/path: improve debug message on redirect Signed-off-by: Karel Zak --- 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; }