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.11.3~6 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c7389bae8e28b17fb4fd9f6c57e537d50b1be893;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 95be9ec3d..4d6f0c6ba 100644 --- a/src/common/compat/directory-handle.c +++ b/src/common/compat/directory-handle.c @@ -292,7 +292,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