1.1 --- a/libfsclient/lib/src/client.cc Thu Oct 20 23:03:41 2022 +0200
1.2 +++ b/libfsclient/lib/src/client.cc Thu Oct 20 23:04:46 2022 +0200
1.3 @@ -293,6 +293,11 @@
1.4 if (file == NULL)
1.5 return NULL;
1.6
1.7 + /* Return the directory structure itself for error handling. */
1.8 +
1.9 + if (!client_opened(file))
1.10 + return file;
1.11 +
1.12 file_t *reader = client_opendir_at(file);
1.13
1.14 /* Release the directory and return the reader even if an error occurs. */
1.15 @@ -307,9 +312,6 @@
1.16
1.17 file_t *client_opendir_at(file_t *file)
1.18 {
1.19 - if (!client_opened(file))
1.20 - return NULL;
1.21 -
1.22 file_t *reader = (file_t *) malloc(sizeof(file_t));
1.23
1.24 if (reader == NULL)