#include <time.h>
#include "udev.h"
+#include "path-util.h"
+#include "conf-files.h"
#define PREALLOC_TOKEN 2048
#define PREALLOC_STRBUF 32 * 1024
FILE *f;
char line[UTIL_LINE_SIZE];
- f = fopen(filename, "r");
+ f = fopen(filename, "re");
if (f == NULL)
return -1;
while (fgets(line, sizeof(line), f) != NULL)
}
log_debug("read rules file: %s\n", filename);
- f = fopen(filename, "r");
+ f = fopen(filename, "re");
if (f == NULL)
return -1;
log_error("failed to build config directory array");
return NULL;
}
- if (!strv_path_canonicalize(rules->dirs)) {
+ if (!path_strv_canonicalize(rules->dirs)) {
log_error("failed to canonicalize config directories\n");
return NULL;
}
unsigned int i;
bool changed = false;
+ if (rules == NULL)
+ goto out;
+
for (i = 0; rules->dirs[i]; i++) {
struct stat stats;
/* update timestamp */
rules->dirs_ts_usec[i] = ts_usec(&stats.st_mtim);
}
-
+out:
return changed;
}
FILE *f;
bool imported = false;
- f = fopen("/proc/cmdline", "r");
+ f = fopen("/proc/cmdline", "re");
if (f != NULL) {
char cmdline[4096];
log_debug("ATTR '%s' writing '%s' %s:%u\n", attr, value,
&rules->buf[rule->rule.filename_off],
rule->rule.filename_line);
- f = fopen(attr, "w");
+ f = fopen(attr, "we");
if (f != NULL) {
if (fprintf(f, "%s", value) <= 0)
log_error("error writing ATTR{%s}: %m\n", attr);