From 345596e3fdf6d0c94a36f36568766c0534ab082b Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 23 Mar 2020 17:39:57 +0100 Subject: [PATCH] pwrap: Improve debug message in p_rmdirs_at() Signed-off-by: Andreas Schneider Reviewed-by: Ralph Boehme --- src/pam_wrapper.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c index b7e3611..67a75b4 100644 --- a/src/pam_wrapper.c +++ b/src/pam_wrapper.c @@ -1824,12 +1824,22 @@ static int p_rmdirs_at(const char *path, int parent_fd) DIR *d = NULL; struct dirent *dp = NULL; struct stat sb; + char fd_str[64] = { 0 }; int path_fd; int rc; + switch(parent_fd) { + case AT_FDCWD: + snprintf(fd_str, sizeof(fd_str), "CWD"); + break; + default: + snprintf(fd_str, sizeof(fd_str), "fd=%d", parent_fd); + break; + } + /* If path is absolute, parent_fd is ignored. */ PWRAP_LOG(PWRAP_LOG_TRACE, - "p_rmdirs_at removing %s at %d\n", path, parent_fd); + "p_rmdirs_at removing %s at %s\n", path, fd_str); path_fd = openat(parent_fd, path, O_RDONLY | O_DIRECTORY | O_NOFOLLOW); -- 2.34.1