# HG changeset patch # User Paul Boddie # Date 1666299886 -7200 # Node ID 0946dd297b3b36d3e346ddb6d6076b2846d7b04b # Parent 07dc5a5e97f8f1262c71c009bd0fe8ce3a3ef193 Return the file structure for certain directory opening failure conditions. diff -r 07dc5a5e97f8 -r 0946dd297b3b libfsclient/lib/src/client.cc --- a/libfsclient/lib/src/client.cc Thu Oct 20 23:03:41 2022 +0200 +++ b/libfsclient/lib/src/client.cc Thu Oct 20 23:04:46 2022 +0200 @@ -293,6 +293,11 @@ if (file == NULL) return NULL; + /* Return the directory structure itself for error handling. */ + + if (!client_opened(file)) + return file; + file_t *reader = client_opendir_at(file); /* Release the directory and return the reader even if an error occurs. */ @@ -307,9 +312,6 @@ file_t *client_opendir_at(file_t *file) { - if (!client_opened(file)) - return NULL; - file_t *reader = (file_t *) malloc(sizeof(file_t)); if (reader == NULL)