]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/path: add more debug messages
authorKarel Zak <kzak@redhat.com>
Fri, 18 May 2018 10:33:03 +0000 (12:33 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 21 Jun 2018 11:07:46 +0000 (13:07 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/path.c

index b1e4d21f7d79c504bffc62fcd1d10232ccb785b0..11cab3aaf852ced45ce18f1bf5b5558f440713b5 100644 (file)
@@ -255,6 +255,7 @@ int ul_path_access(struct path_cxt *pc, int mode, const char *path)
        if (dir < 0)
                return dir;
 
+       DBG(CXT, ul_debugobj(pc, "access: '%s'", path));
        rc = faccessat(dir, path, mode, 0);
 
        if (rc && errno == ENOENT
@@ -283,7 +284,7 @@ int ul_path_open(struct path_cxt *pc, int flags, const char *path)
 
        if (!pc) {
                fd = open(path, flags);
-               DBG(CXT, ul_debug("opening '%s'", path));
+               DBG(CXT, ul_debug("opening [%d] '%s'", flags, path));
        } else {
                int dir = ul_path_get_dirfd(pc);
                if (dir < 0)
@@ -296,7 +297,7 @@ int ul_path_open(struct path_cxt *pc, int flags, const char *path)
                    && 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 [%d] '%s'", flags, path));
        }
        return fd;
 }
@@ -500,6 +501,7 @@ int ul_path_read(struct path_cxt *pc, char *buf, size_t len, const char *path)
        if (fd < 0)
                return -errno;
 
+       DBG(CXT, ul_debug(" reading '%s'", path));
        rc = read_all(fd, buf, len);
 
        errsv = errno;
@@ -615,6 +617,8 @@ int ul_path_scanf(struct path_cxt *pc, const char *path, const char *fmt, ...)
        if (!f)
                return -EINVAL;
 
+       DBG(CXT, ul_debug(" fscanf [%s] '%s'", fmt, path));
+
        va_start(fmt_ap, fmt);
        rc = vfscanf(f, fmt, fmt_ap);
        va_end(fmt_ap);