#include "strbuf.h"
#include "string-util.h"
#include "strv.h"
+#include "tmpfile-util.h"
static const char *default_hwdb_bin_dir = "/etc/udev";
static const char * const conf_file_dirs[] = {
static int trie_node_add_value(struct trie *trie, struct trie_node *node,
const char *key, const char *value,
const char *filename, uint16_t file_priority, uint32_t line_number, bool compat) {
- ssize_t k, v, fn;
+ ssize_t k, v, fn = 0;
struct trie_value_entry *val;
k = strbuf_add_string(trie->strings, key, strlen(key));
HW_DATA,
} state = HW_NONE;
_cleanup_fclose_ FILE *f = NULL;
- char line[LINE_MAX];
_cleanup_strv_free_ char **match_list = NULL;
uint32_t line_number = 0;
char *match = NULL;
if (!f)
return -errno;
- while (fgets(line, sizeof(line), f)) {
+ for (;;) {
+ _cleanup_free_ char *line = NULL;
size_t len;
char *pos;
+ r = read_line(f, LONG_LINE_MAX, &line);
+ if (r < 0)
+ return r;
+ if (r == 0)
+ break;
+
++line_number;
/* comment line */