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.13.0-rc1~728 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=dbc179cb731580b829facb1b901238c507a6f593;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