directory-handle: print `errno` reason on `unlinkat()` error
[lttng-tools.git] / src / common / compat / directory-handle.c
index 4dad7b75744a7d81305910a3d86556cca3179bf1..4d6f0c6ba8be6cb9c72755d26aa758ec844b07b5 100644 (file)
@@ -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
@@ -1069,9 +1074,13 @@ struct rmdir_frame {
 static
 void rmdir_frame_fini(void *data)
 {
+       int ret;
        struct rmdir_frame *frame = data;
 
-       closedir(frame->dir);
+       ret = closedir(frame->dir);
+       if (ret == -1) {
+               PERROR("Failed to close directory stream");
+       }
 }
 
 static
This page took 0.024157 seconds and 4 git commands to generate.