* [PATCH] crda: allow loading of regulatory.bin from /lib/crda in addition to /usr/lib/crda
@ 2009-02-24 14:31 Helmut Schaa
2009-02-24 14:55 ` John W. Linville
0 siblings, 1 reply; 3+ messages in thread
From: Helmut Schaa @ 2009-02-24 14:31 UTC (permalink / raw)
To: Luis R Rodriguez; +Cc: linux-wireless
As crda is typically installed in /sbin it might be worth to install
regulatory.bin into /lib/crda instead of /usr/lib/crda. Hence, extend
crda to try both paths for loading the database.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
---
diff --git a/crda.c b/crda.c
index f2c471f..55632a6 100644
--- a/crda.c
+++ b/crda.c
@@ -143,7 +143,7 @@ nla_put_failure:
int main(int argc, char **argv)
{
- int fd;
+ int fd = -1;
struct stat stat;
__u8 *db;
struct regdb_file_header *header;
@@ -162,7 +162,12 @@ int main(int argc, char **argv)
struct nlattr *nl_reg_rules;
int num_rules;
- const char regdb[] = "/usr/lib/crda/regulatory.bin";
+ const char *regdb_paths[] = {
+ "/usr/lib/crda/regulatory.bin",
+ "/lib/crda/regulatory.bin",
+ NULL
+ };
+ const char **regdb = regdb_paths;
if (argc != 1) {
fprintf(stderr, "Usage: %s\n", argv[0]);
@@ -183,7 +188,12 @@ int main(int argc, char **argv)
memcpy(alpha2, env_country, 2);
- fd = open(regdb, O_RDONLY);
+ while (*regdb != NULL) {
+ fd = open(*regdb, O_RDONLY);
+ if (fd >= 0)
+ break;
+ regdb++;
+ }
if (fd < 0) {
perror("failed to open db file");
return -ENOENT;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] crda: allow loading of regulatory.bin from /lib/crda in addition to /usr/lib/crda
2009-02-24 14:31 [PATCH] crda: allow loading of regulatory.bin from /lib/crda in addition to /usr/lib/crda Helmut Schaa
@ 2009-02-24 14:55 ` John W. Linville
2009-02-24 19:46 ` Luis R. Rodriguez
0 siblings, 1 reply; 3+ messages in thread
From: John W. Linville @ 2009-02-24 14:55 UTC (permalink / raw)
To: Helmut Schaa; +Cc: Luis R Rodriguez, linux-wireless
On Tue, Feb 24, 2009 at 03:31:50PM +0100, Helmut Schaa wrote:
> As crda is typically installed in /sbin it might be worth to install
> regulatory.bin into /lib/crda instead of /usr/lib/crda. Hence, extend
> crda to try both paths for loading the database.
>
> Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Is it worthwhile to add /usr/local/lib/crda too? That way a user could
override the regulatory.bin without disturbing the distro's packaging.
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crda: allow loading of regulatory.bin from /lib/crda in addition to /usr/lib/crda
2009-02-24 14:55 ` John W. Linville
@ 2009-02-24 19:46 ` Luis R. Rodriguez
0 siblings, 0 replies; 3+ messages in thread
From: Luis R. Rodriguez @ 2009-02-24 19:46 UTC (permalink / raw)
To: John W. Linville; +Cc: Helmut Schaa, linux-wireless
On Tue, Feb 24, 2009 at 6:55 AM, John W. Linville
<linville@tuxdriver.com> wrote:
> On Tue, Feb 24, 2009 at 03:31:50PM +0100, Helmut Schaa wrote:
>> As crda is typically installed in /sbin it might be worth to install
>> regulatory.bin into /lib/crda instead of /usr/lib/crda. Hence, exten=
d
>> crda to try both paths for loading the database.
>>
>> Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Thanks Helmut, applied.
> Is it worthwhile to add /usr/local/lib/crda too? =C2=A0That way a use=
r could
> override the regulatory.bin without disturbing the distro's packaging=
=2E
Added that as well and added that first in the path.
Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-02-24 19:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-24 14:31 [PATCH] crda: allow loading of regulatory.bin from /lib/crda in addition to /usr/lib/crda Helmut Schaa
2009-02-24 14:55 ` John W. Linville
2009-02-24 19:46 ` Luis R. Rodriguez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).