summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2019-07-17 15:07:14 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2020-06-05 04:26:14 +0000
commitdcaa947c488b4cb458946ab9c19579f7c866cbd4 (patch)
treef82e3003be6d7c62d7d2994b65133d9f112b057c
parentd373c9b434c603bf6a5eb442b6427992d23ef874 (diff)
For -R and after chdir, add the current directory to the path
This restores the behavior pre 1aecdffaa0db7bbf85bc0aae9043e9437b25c30d, at least when -R is given. For a normal invocation without -R we don't add the current directory, because 1aecdff isn't totally wrong about whether that's a good idea. Fixes https://gitlab.freedesktop.org/xorg/app/xkbcomp/issues/3
-rw-r--r--xkbcomp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/xkbcomp.c b/xkbcomp.c
index 51eb224..37dc8f5 100644
--- a/xkbcomp.c
+++ b/xkbcomp.c
@@ -549,11 +549,14 @@ parseArgs(int argc, char *argv[])
{
WARN1("Changing root directory to \"%s\"\n", rootDir);
}
- if ((chdir(rootDir) < 0) && (warningLevel > 0))
+ if (chdir(rootDir) == 0)
{
- WARN1("Couldn't change directory to \"%s\"\n", rootDir);
- ACTION("Root directory (-R) option ignored\n");
- rootDir = NULL;
+ XkbAddDirectoryToPath(".");
+ } else if (warningLevel > 0)
+ {
+ WARN1("Couldn't change directory to \"%s\"\n", rootDir);
+ ACTION("Root directory (-R) option ignored\n");
+ rootDir = NULL;
}
}
}