From efa3bc3eca82c34429b1acb10f9b4e9182d49081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 19 Aug 2011 19:12:29 +0000 Subject: [PATCH] * Now reads the irs.conf from /boot/common/settings/network/irs.conf instead of /etc/irs.conf. Untested. * There are more config files, but I'm not even sure what they are used for. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42643 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/network/libbind/irs/gen.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/kits/network/libbind/irs/gen.c b/src/kits/network/libbind/irs/gen.c index 04105b3025..bbfd3bf50f 100644 --- a/src/kits/network/libbind/irs/gen.c +++ b/src/kits/network/libbind/irs/gen.c @@ -26,7 +26,7 @@ static const char rcsid[] = "$Id: gen.c,v 1.7 2005/04/27 04:56:23 sra Exp $"; * The dispatcher is implemented as an accessor class; it is an * accessor class that calls other accessor classes, as controlled by a * configuration file. - * + * * A big difference between this accessor class and others is that the * map class initializers are NULL, and the map classes are already * filled in with method functions that will do the right thing. @@ -44,10 +44,12 @@ static const char rcsid[] = "$Id: gen.c,v 1.7 2005/04/27 04:56:23 sra Exp $"; #include #include -#include +#include #include #include +#include + #include #include @@ -121,7 +123,7 @@ struct irs_acc * irs_gen_acc(const char *options, const char *conf_file) { struct irs_acc *acc; struct gen_p *irs; - + if (!(acc = memget(sizeof *acc))) { errno = ENOMEM; return (NULL); @@ -218,7 +220,7 @@ static void gen_close(struct irs_acc *this) { struct gen_p *irs = (struct gen_p *)this->private; int n; - + /* Search rules. */ for (n = 0; n < irs_nmap; n++) while (irs->map_rules[n] != NULL) @@ -382,10 +384,17 @@ default_map_rules(struct gen_p *irs) { static void init_map_rules(struct gen_p *irs, const char *conf_file) { char line[1024], pattern[40], mapname[20], accname[20], options[100]; + char path[PATH_MAX]; FILE *conf; - if (conf_file == NULL) - conf_file = _PATH_IRS_CONF ; + if (conf_file == NULL) { + if (find_directory(B_COMMON_SETTINGS_DIRECTORY, -1, false, path, + sizeof(path)) == B_OK) { + strlcat(path, "/network/irs.conf", sizeof(path)); + conf_file = path; + } else + conf_file = _PATH_IRS_CONF; + } /* A conf file of "" means compiled in defaults. Irpd wants this */ if (conf_file[0] == '\0' || (conf = fopen(conf_file, "r")) == NULL) {