summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-09-06 16:53:14 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-09-07 12:13:49 +0200
commit77f89e933034d150b54e10552504b8c6f013c3fd (patch)
tree25c8253ef86b920175f5f160f56ab9e734c06d99
parentf61e72d8973cf9d889a4f1233150870085c0b3e1 (diff)
Revert "udev-rules.c: remove 'first_token' variable"
That was a mistake. The variable is needed to be set before we parse the file. Thanks a lot to Alan Jenkins for spotting this. This reverts commit 710fdac1e49276683abe927472fe1b336960edd8.
-rw-r--r--udev/udev-rules.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/udev/udev-rules.c b/udev/udev-rules.c
index da08bc11f6..a92446403f 100644
--- a/udev/udev-rules.c
+++ b/udev/udev-rules.c
@@ -1568,6 +1568,7 @@ invalid:
static int parse_file(struct udev_rules *rules, const char *filename, unsigned short filename_off)
{
FILE *f;
+ unsigned int first_token;
char line[UTIL_LINE_SIZE];
int line_nr = 0;
unsigned int i;
@@ -1577,7 +1578,10 @@ static int parse_file(struct udev_rules *rules, const char *filename, unsigned s
f = fopen(filename, "r");
if (f == NULL)
return -1;
- while (fgets(line, sizeof(line), f) != NULL) {
+
+ first_token = rules->token_cur;
+
+ while(fgets(line, sizeof(line), f) != NULL) {
char *key;
size_t len;
@@ -1614,7 +1618,7 @@ static int parse_file(struct udev_rules *rules, const char *filename, unsigned s
fclose(f);
/* link GOTOs to LABEL rules in this file to be able to fast-forward */
- for (i = rules->token_cur+1; i < rules->token_cur; i++) {
+ for (i = first_token+1; i < rules->token_cur; i++) {
if (rules->tokens[i].type == TK_A_GOTO) {
char *label = &rules->buf[rules->tokens[i].key.value_off];
unsigned int j;