summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2015-02-11 16:53:37 -0500
committerAnthony G. Basile <blueness@gentoo.org>2015-02-11 16:53:37 -0500
commit0a5fbf1cdb55852d2a80fafa871b63c93c52c413 (patch)
tree6f591d28a9156a1ef11ea8968d0b72738c600581
parente0bb33e4a80f8b0ada8283cb731377f5103dd0d8 (diff)
Minor cleanups
-rw-r--r--src/libudev/libudev-device.c44
-rw-r--r--src/shared/util.c1
-rw-r--r--src/udev/udev-builtin-net_id.c2
-rw-r--r--src/udev/udev-rules.c12
-rw-r--r--src/udev/udevadm-info.c1
5 files changed, 29 insertions, 31 deletions
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index 6b7de7e5ef..9863901a33 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -1923,6 +1923,28 @@ void udev_device_set_db_persist(struct udev_device *udev_device)
udev_device->db_persist = true;
}
+int udev_device_rename(struct udev_device *udev_device, const char *name)
+{
+ _cleanup_free_ char *dirname = NULL;
+ char *new_syspath;
+ int r;
+
+ if (udev_device == NULL || name == NULL)
+ return -EINVAL;
+
+ dirname = dirname_malloc(udev_device->syspath);
+ if (!dirname)
+ return -ENOMEM;
+
+ new_syspath = strjoina(dirname, "/", name);
+
+ r = udev_device_set_syspath(udev_device, new_syspath);
+ if (r < 0)
+ return r;
+
+ return 0;
+}
+
struct udev_device *udev_device_shallow_clone(struct udev_device *old_device)
{
struct udev_device *device;
@@ -1988,25 +2010,3 @@ struct udev_device *udev_device_new_from_nulstr(struct udev *udev, char *nulstr,
return device;
}
-
-int udev_device_rename(struct udev_device *udev_device, const char *name)
-{
- _cleanup_free_ char *dirname = NULL;
- char *new_syspath;
- int r;
-
- if (udev_device == NULL || name == NULL)
- return -EINVAL;
-
- dirname = dirname_malloc(udev_device->syspath);
- if (!dirname)
- return -ENOMEM;
-
- new_syspath = strjoina(dirname, "/", name);
-
- r = udev_device_set_syspath(udev_device, new_syspath);
- if (r < 0)
- return r;
-
- return 0;
-}
diff --git a/src/shared/util.c b/src/shared/util.c
index 091b3c04a1..0eca4f8562 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -55,6 +55,7 @@
#include <limits.h>
#include <langinfo.h>
#include <locale.h>
+#include <libgen.h>
#include "macro.h"
#include "util.h"
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 97eb9dec06..37ff1b8008 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -1,5 +1,5 @@
/***
- This file is part of eudev, forked from systemd.
+ This file is part of systemd.
Copyright 2012 Kay Sievers <kay@vrfy.org>
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 11cf21a4fb..54c865f143 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -1420,12 +1420,12 @@ static int add_rule(struct udev_rules *rules, char *line,
} else {
if (streq(value, "%k")) {
log_error("NAME=\"%%k\" is ignored, because it breaks kernel supplied names, "
- "please remove it from %s:%u", filename, lineno);
+ "please remove it from %s:%u\n", filename, lineno);
continue;
}
if (value[0] == '\0') {
log_debug("NAME=\"\" is ignored, because udev will not delete any device nodes, "
- "please remove it from %s:%u", filename, lineno);
+ "please remove it from %s:%u\n", filename, lineno);
continue;
}
rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL);
@@ -2454,7 +2454,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules,
if (major(udev_device_get_devnum(event->dev)) &&
(!streq(name_str, udev_device_get_devnode(event->dev) + strlen("/dev/")))) {
log_error("NAME=\"%s\" ignored, kernel device nodes "
- "can not be renamed; please fix it in %s:%u", name,
+ "can not be renamed; please fix it in %s:%u\n", name,
rules_str(rules, rule->rule.filename_off), rule->rule.filename_line);
break;
}
@@ -2646,10 +2646,8 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules) {
strscpyl(tags_dir, sizeof(tags_dir), "/run/udev/static_node-tags/", *t, "/", NULL);
r = mkdir_p(tags_dir, 0755);
- if (r < 0) {
- log_error_errno(r, "failed to create %s: %m", tags_dir);
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "failed to create %s: %m", tags_dir);
unescaped_filename = xescape(rules_str(rules, cur->key.value_off), "/.");
diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c
index 48c0e79406..0e53d2e46c 100644
--- a/src/udev/udevadm-info.c
+++ b/src/udev/udevadm-info.c
@@ -32,7 +32,6 @@
#include "udev.h"
#include "udev-util.h"
#include "udevadm-util.h"
-#include "util.h"
static bool skip_attribute(const char *name) {
static const char* const skip[] = {