fs: fix fugue_dir_explore() error not propagating to open()

This commit is contained in:
Lephe 2024-02-04 18:50:37 +01:00
parent 1e220af616
commit 542b4f0a81
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
2 changed files with 6 additions and 1 deletions

View File

@ -118,7 +118,7 @@ void *fugue_dir_explore(char const *path)
if(rc < 0) {
if(rc != BFile_EntryNotFound)
errno = bfile_error_to_errno(rc);
goto end;
goto error;
}
do {
@ -148,6 +148,7 @@ void *fugue_dir_explore(char const *path)
alloc_failure:
errno = ENOMEM;
error:
fugue_dir_close(dp);
dp = NULL;
end:

View File

@ -63,6 +63,10 @@ int fugue_open(char const *path, int flags, GUNUSED mode_t mode)
/* If the entry is a directory, open it as such */
if(type == BFile_Type_Directory) {
void *dp = fugue_dir_explore(path);
if(!dp) {
rc = -1;
goto end;
}
fs_descriptor_t data = {
.type = &fugue_dir_descriptor_type,
.data = dp,