Skip to content

Commit 4494ce2

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)
1 parent 23bf25c commit 4494ce2

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
@@ -466,7 +466,7 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
466466
_cleanup_fclose_ FILE *f = NULL;
467467
_cleanup_strv_free_ char **match_list = NULL;
468468
uint32_t line_number = 0;
469-
int r, err;
469+
int r;
470470

471471
f = fopen(filename, "re");
472472
if (!f)
@@ -506,43 +506,39 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
506506
break;
507507

508508
if (line[0] == ' ') {
509-
r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
510-
"Match expected but got indented property \"%s\", ignoring line.", line);
509+
log_syntax(NULL, LOG_WARNING, filename, line_number, 0,
510+
"Match expected but got indented property \"%s\", ignoring line.", line);
511511
break;
512512
}
513513

514514
/* start of record, first match */
515515
state = HW_MATCH;
516516

517-
err = strv_extend(&match_list, line);
518-
if (err < 0)
519-
return err;
520-
517+
r = strv_extend(&match_list, line);
518+
if (r < 0)
519+
return r;
521520
break;
522521

523522
case HW_MATCH:
524523
if (len == 0) {
525-
r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
526-
"Property expected, ignoring record with no properties.");
524+
log_syntax(NULL, LOG_WARNING, filename, line_number, 0,
525+
"Property expected, ignoring record with no properties.");
527526
state = HW_NONE;
528527
match_list = strv_free(match_list);
529528
break;
530529
}
531530

532531
if (line[0] != ' ') {
533532
/* another match */
534-
err = strv_extend(&match_list, line);
535-
if (err < 0)
536-
return err;
537-
533+
r = strv_extend(&match_list, line);
534+
if (r < 0)
535+
return r;
538536
break;
539537
}
540538

541539
/* first data */
542540
state = HW_DATA;
543-
err = insert_data(trie, match_list, line, filename, file_priority, line_number, compat);
544-
if (err < 0)
545-
r = err;
541+
(void) insert_data(trie, match_list, line, filename, file_priority, line_number, compat);
546542
break;
547543

548544
case HW_DATA:
@@ -554,16 +550,14 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
554550
}
555551

556552
if (line[0] != ' ') {
557-
r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
558-
"Property or empty line expected, got \"%s\", ignoring record.", line);
553+
log_syntax(NULL, LOG_WARNING, filename, line_number, 0,
554+
"Property or empty line expected, got \"%s\", ignoring record.", line);
559555
state = HW_NONE;
560556
match_list = strv_free(match_list);
561557
break;
562558
}
563559

564-
err = insert_data(trie, match_list, line, filename, file_priority, line_number, compat);
565-
if (err < 0)
566-
r = err;
560+
(void) insert_data(trie, match_list, line, filename, file_priority, line_number, compat);
567561
break;
568562
};
569563
}

0 commit comments

Comments
 (0)