Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setroot is broken on linux #82

Open
StephaneTy-Pro opened this issue Oct 22, 2024 · 1 comment
Open

setroot is broken on linux #82

StephaneTy-Pro opened this issue Oct 22, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@StephaneTy-Pro
Copy link

StephaneTy-Pro commented Oct 22, 2024

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
@StephaneTy-Pro StephaneTy-Pro added the bug Something isn't working label Oct 22, 2024
@AlbertShown
Copy link
Contributor

That's sound a legitimate fix! 👍
Can you please open a PR with those changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants