Make conftab.c independent of the current directory

read_builtin_tables() wanted to run in builtindir, and
read_custom_tables() wanted to run in configdir.  Bothersome.  Use new
fopenat() to relax those requirements.

The chdir() satisfying them are now superflous, remove them.
This commit is contained in:
Markus Armbruster 2008-02-03 21:43:49 +01:00
parent 4bb23dd1a6
commit b76e5a5eed
4 changed files with 30 additions and 17 deletions

View file

@ -214,23 +214,8 @@ main(int argc, char **argv)
if (emp_config(config_file) < 0)
exit(EXIT_FAILURE);
ef_init();
if (chdir(configdir)) {
fprintf(stderr, "Can't chdir to %s (%s)\n",
configdir, strerror(errno));
exit(EXIT_FAILURE);
}
if (chdir(builtindir)) {
fprintf(stderr, "Can't chdir to %s (%s)\n",
builtindir, strerror(errno));
exit(EXIT_FAILURE);
}
if (read_builtin_tables() < 0)
exit(EXIT_FAILURE);
if (chdir(configdir)) {
fprintf(stderr, "Can't chdir to %s (%s)\n",
configdir, strerror(errno));
exit(EXIT_FAILURE);
}
if (read_custom_tables() < 0)
exit(EXIT_FAILURE);
if (chdir(gamedir)) {