mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-14 21:17:54 +00:00
[client] config: do not attempt to load non-files as config
Currently, we load /etc/looking-glass-client.ini and/or ~/.config/looking-glass-client.ini as long as they exist, even if they are not files. We should only load them if they are files.
This commit is contained in:
parent
7d78cba38c
commit
68d8d95266
1 changed files with 2 additions and 2 deletions
|
@ -473,7 +473,7 @@ bool config_load(int argc, char * argv[])
|
||||||
{
|
{
|
||||||
// load any global options first
|
// load any global options first
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat("/etc/looking-glass-client.ini", &st) >= 0)
|
if (stat("/etc/looking-glass-client.ini", &st) >= 0 && S_ISREG(st.st_mode))
|
||||||
{
|
{
|
||||||
DEBUG_INFO("Loading config from: /etc/looking-glass-client.ini");
|
DEBUG_INFO("Loading config from: /etc/looking-glass-client.ini");
|
||||||
if (!option_load("/etc/looking-glass-client.ini"))
|
if (!option_load("/etc/looking-glass-client.ini"))
|
||||||
|
@ -484,7 +484,7 @@ bool config_load(int argc, char * argv[])
|
||||||
struct passwd * pw = getpwuid(getuid());
|
struct passwd * pw = getpwuid(getuid());
|
||||||
char * localFile;
|
char * localFile;
|
||||||
alloc_sprintf(&localFile, "%s/.looking-glass-client.ini", pw->pw_dir);
|
alloc_sprintf(&localFile, "%s/.looking-glass-client.ini", pw->pw_dir);
|
||||||
if (stat(localFile, &st) >= 0)
|
if (stat(localFile, &st) >= 0 && S_ISREG(st.st_mode))
|
||||||
{
|
{
|
||||||
DEBUG_INFO("Loading config from: %s", localFile);
|
DEBUG_INFO("Loading config from: %s", localFile);
|
||||||
if (!option_load(localFile))
|
if (!option_load(localFile))
|
||||||
|
|
Loading…
Reference in a new issue