Skip to content

Commit eb427f7

Browse files
yuwatabluca
authored andcommitted
hwdb-util: drop unused value assignment
The values assigned to 'r' were never used, and overwritten by the next call of read_line_full(). Fixes CID#1548043 and CID#1548064. (cherry picked from commit 00575cf) (cherry picked from commit 244790a) (cherry picked from commit f92b518) (cherry picked from commit 8858f69) (cherry picked from commit 4494ce2) (cherry picked from commit b687cc0)
1 parent 2e08031 commit eb427f7

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

src/shared/hwdb-util.c

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
469469
_cleanup_fclose_ FILE *f = NULL;
470470
_cleanup_strv_free_ char **match_list = NULL;
471471
uint32_t line_number = 0;
472-
int r, err;
472+
int r;
473473

474474
f = fopen(filename, "re");
475475
if (!f)
@@ -509,43 +509,39 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
509509
break;
510510

511511
if (line[0] == ' ') {
512-
r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
513-
"Match expected but got indented property \"%s\", ignoring line.", line);
512+
log_syntax(NULL, LOG_WARNING, filename, line_number, 0,
513+
"Match expected but got indented property \"%s\", ignoring line.", line);
514514
break;
515515
}
516516

517517
/* start of record, first match */
518518
state = HW_MATCH;
519519

520-
err = strv_extend(&match_list, line);
521-
if (err < 0)
522-
return err;
523-
520+
r = strv_extend(&match_list, line);
521+
if (r < 0)
522+
return r;
524523
break;
525524

526525
case HW_MATCH:
527526
if (len == 0) {
528-
r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
529-
"Property expected, ignoring record with no properties.");
527+
log_syntax(NULL, LOG_WARNING, filename, line_number, 0,
528+
"Property expected, ignoring record with no properties.");
530529
state = HW_NONE;
531530
match_list = strv_free(match_list);
532531
break;
533532
}
534533

535534
if (line[0] != ' ') {
536535
/* another match */
537-
err = strv_extend(&match_list, line);
538-
if (err < 0)
539-
return err;
540-
536+
r = strv_extend(&match_list, line);
537+
if (r < 0)
538+
return r;
541539
break;
542540
}
543541

544542
/* first data */
545543
state = HW_DATA;
546-
err = insert_data(trie, match_list, line, filename, file_priority, line_number, compat);
547-
if (err < 0)
548-
r = err;
544+
(void) insert_data(trie, match_list, line, filename, file_priority, line_number, compat);
549545
break;
550546

551547
case HW_DATA:
@@ -557,16 +553,14 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
557553
}
558554

559555
if (line[0] != ' ') {
560-
r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
561-
"Property or empty line expected, got \"%s\", ignoring record.", line);
556+
log_syntax(NULL, LOG_WARNING, filename, line_number, 0,
557+
"Property or empty line expected, got \"%s\", ignoring record.", line);
562558
state = HW_NONE;
563559
match_list = strv_free(match_list);
564560
break;
565561
}
566562

567-
err = insert_data(trie, match_list, line, filename, file_priority, line_number, compat);
568-
if (err < 0)
569-
r = err;
563+
(void) insert_data(trie, match_list, line, filename, file_priority, line_number, compat);
570564
break;
571565
};
572566
}

0 commit comments

Comments
 (0)