summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mandriva.org>2009-09-23 14:36:19 +0000
committerPascal Terjan <pterjan@mandriva.org>2009-09-23 14:36:19 +0000
commit1f0d7b25c5adc7b581f4c98c614291a89ac9050b (patch)
treefe739aeb70041cb68e854b760fa13d68086839d0
parent4d2acf72f3bb7a2db24a1dccfdf6a4d8c555174b (diff)
downloadldetect-1f0d7b25c5adc7b581f4c98c614291a89ac9050b.tar
ldetect-1f0d7b25c5adc7b581f4c98c614291a89ac9050b.tar.gz
ldetect-1f0d7b25c5adc7b581f4c98c614291a89ac9050b.tar.bz2
ldetect-1f0d7b25c5adc7b581f4c98c614291a89ac9050b.tar.xz
ldetect-1f0d7b25c5adc7b581f4c98c614291a89ac9050b.zip
parse only once usb.ids (avoids displaying Duplicate errors)
-rw-r--r--NEWS2
-rw-r--r--names.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 995c7ee..cd9cf64 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- parse only once usb.ids (avoids displaying Duplicate errors)
+
Version 0.8.5 - 14 September 2009, Pascal Terjan
- do not display any warning when driver field is empty in
diff --git a/names.c b/names.c
index d9ed81a..a39425d 100644
--- a/names.c
+++ b/names.c
@@ -138,6 +138,8 @@ static struct genericstrtable *hutus[HASHSZ] = { NULL, };
static struct genericstrtable *langids[HASHSZ] = { NULL, };
static struct genericstrtable *countrycodes[HASHSZ] = { NULL, };
+static int init_done = 0;
+
/* ---------------------------------------------------------------------- */
static const char *names_genericstrtable(struct genericstrtable *t[HASHSZ], unsigned int index)
@@ -799,7 +801,9 @@ static void parse(usb_file f)
int names_init(char *n)
{
usb_file f;
-
+ if(init_done)
+ return 0;
+ init_done = 1;
if (!(f = usb_fopen(n, "r"))) {
return errno;
}