61 lines
2.5 KiB
Diff
61 lines
2.5 KiB
Diff
From e63854bf942d6f3364e5e69d5e7bcfd5a2ad8ec8 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Date: Sat, 1 Nov 2014 11:32:44 -0400
|
|
Subject: [PATCH] libudev: modernization
|
|
|
|
This brings udev logging style a bit closer to normal systemd convention.
|
|
|
|
(cherry picked from commit fe756ed9ec2c0fa33c30b1d9a33d745dc1593aed)
|
|
---
|
|
src/libudev/libudev.c | 9 ++++-----
|
|
1 file changed, 4 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c
|
|
index e2ab960d55..7803863b2e 100644
|
|
--- a/src/libudev/libudev.c
|
|
+++ b/src/libudev/libudev.c
|
|
@@ -119,7 +119,7 @@ _public_ struct udev *udev_new(void)
|
|
{
|
|
struct udev *udev;
|
|
const char *env;
|
|
- FILE *f;
|
|
+ _cleanup_free_ FILE *f = NULL;
|
|
|
|
udev = new0(struct udev, 1);
|
|
if (udev == NULL)
|
|
@@ -132,7 +132,7 @@ _public_ struct udev *udev_new(void)
|
|
f = fopen("/etc/udev/udev.conf", "re");
|
|
if (f != NULL) {
|
|
char line[UTIL_LINE_SIZE];
|
|
- int line_nr = 0;
|
|
+ unsigned line_nr = 0;
|
|
|
|
while (fgets(line, sizeof(line), f)) {
|
|
size_t len;
|
|
@@ -153,7 +153,7 @@ _public_ struct udev *udev_new(void)
|
|
/* split key/value */
|
|
val = strchr(key, '=');
|
|
if (val == NULL) {
|
|
- udev_err(udev, "missing <key>=<value> in /etc/udev/udev.conf[%i]; skip line\n", line_nr);
|
|
+ udev_err(udev, "/etc/udev/udev.conf:%u: missing assignment, skipping line.\n", line_nr);
|
|
continue;
|
|
}
|
|
val[0] = '\0';
|
|
@@ -185,7 +185,7 @@ _public_ struct udev *udev_new(void)
|
|
/* unquote */
|
|
if (val[0] == '"' || val[0] == '\'') {
|
|
if (val[len-1] != val[0]) {
|
|
- udev_err(udev, "inconsistent quoting in /etc/udev/udev.conf[%i]; skip line\n", line_nr);
|
|
+ udev_err(udev, "/etc/udev/udev.conf:%u: inconsistent quoting, skipping line.\n", line_nr);
|
|
continue;
|
|
}
|
|
val[len-1] = '\0';
|
|
@@ -197,7 +197,6 @@ _public_ struct udev *udev_new(void)
|
|
continue;
|
|
}
|
|
}
|
|
- fclose(f);
|
|
}
|
|
|
|
/* environment overrides config */
|