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

firetools can't create ~/.config/firetools if ~/.config doesn't exist #72

Open
audibleptr opened this issue Mar 30, 2023 · 0 comments
Open

Comments

@audibleptr
Copy link

The code here:

// create firetools directory if it doesn't exist
void create_config_directory() {
struct stat s;
char *path;
char *homedir = get_home_directory();
if (asprintf(&path, "%s/.config/firetools", homedir) == -1)
errExit("asprintf");
free(homedir);
if (stat(path, &s) == -1) {
/* coverity[toctou] */
int rv = mkdir(path, 0755);
if (rv == -1) {
fprintf(stderr, "Error: cannot create %s directory\n", path);
exit(1);
}
}
free(path);
}

can't create the ~/.config/firetools directory if ~/.configdoesn't exist. Apparently mkdir(...) doesn't directly support creating all the directories along the path (the way mkdir -p does).

This makes firetools fail to launch if ~/.configdoesn't exist.

Specifically, while this may be a rare occurrence in regular users' home directories, it can happen when launching firetools as root (having the home directory /root) where the home directory may not contain a .config subdirectory by default in some distributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant