From: Francis Deslauriers Date: Mon, 9 Mar 2020 14:49:51 +0000 (-0400) Subject: directory-handle: print `errno` reason on `unlinkat()` error X-Git-Tag: v2.12.0-rc2~28 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f7eeabf375b9a008b03d5dedc06f3974d1b6f7ac;p=lttng-tools.git directory-handle: print `errno` reason on `unlinkat()` error This is helpful while troubleshooting clear and rotation issues. Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau Change-Id: I92f9551a49fced7603c8dca832566de71b188528 --- diff --git a/src/common/compat/directory-handle.c b/src/common/compat/directory-handle.c index a790c5b79..aea4be5fe 100644 --- a/src/common/compat/directory-handle.c +++ b/src/common/compat/directory-handle.c @@ -355,7 +355,12 @@ static int lttng_directory_handle_rmdir( const struct lttng_directory_handle *handle, const char *name) { - return unlinkat(handle->dirfd, name, AT_REMOVEDIR); + int ret = unlinkat(handle->dirfd, name, AT_REMOVEDIR); + if (ret) { + PERROR("Failed to remove directory `%s`", name); + } + + return ret; } static