Skip to content

setroot is broken on linux #82

@StephaneTy-Pro

Description

@StephaneTy-Pro

Description

nothing is shown (default html page for fail)

Expected Behavior

use the page to show

Reproduction Steps

No response

Error Logs

No response

Possible Solution

  • file detection using access give true if it's a file or a dir , so _webui_file_exist used by _webui_folder_exist return it's a file despite it was a folder

i'm not a c dev , but this was the solution i use

add sys/stat.h on header for linux

and replace

//return (WEBUI_FILE_EXIST(full_path, 0) == 0);

by

    struct stat path_stat;
    if (stat(full_path, &path_stat) != 0) {
        return false;  // Path does not exist
        #ifdef WEBUI_LOG_VERBOSE
        printf("[Core]\t\t_webui_file_exist() Path does not exist\n", full_path);
        #endif
    }
     // Check if it's a regular file (not a directory)
    if (S_ISREG(path_stat.st_mode)) {
		#ifdef WEBUI_LOG_VERBOSE
		printf("[Core]\t\t_webui_file_exist() [%s] is a regular file\n", full_path);
		#endif
        return true;
    } else {
		#ifdef WEBUI_LOG_VERBOSE
		printf("[Core]\t\t_webui_file_exist() [%s] is NOT a regular file\n", full_path);
		#endif
        return false;
    }

Version

2.5.0-beta2

Environment Details (OS name, version, etc.)

linux 5.10.0-12

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions