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