summaryrefslogtreecommitdiff
path: root/src/libudev
diff options
context:
space:
mode:
authorDavid Cortarello <dcortarello@gmail.com>2015-03-25 01:48:36 -0300
committerAnthony G. Basile <blueness@gentoo.org>2015-03-27 11:34:13 -0400
commit6a398265f3bd30a252cba2b1ada04ff1c617cf96 (patch)
tree2a0761e4c4b46b8bb433e24032a4353cab3bed58 /src/libudev
parent3cda11ed7c226adc9f4818cecfb21974239d632b (diff)
Remove hardcoded path /run and configure using --with-rootrundir=
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/libudev')
-rw-r--r--src/libudev/Makefile.am1
-rw-r--r--src/libudev/libudev-device-private.c6
-rw-r--r--src/libudev/libudev-device.c2
-rw-r--r--src/libudev/libudev-enumerate.c2
-rw-r--r--src/libudev/libudev-monitor.c2
-rw-r--r--src/libudev/libudev-queue.c6
6 files changed, 10 insertions, 9 deletions
diff --git a/src/libudev/Makefile.am b/src/libudev/Makefile.am
index 953199beae..c62bd75858 100644
--- a/src/libudev/Makefile.am
+++ b/src/libudev/Makefile.am
@@ -16,6 +16,7 @@ endef
AM_CPPFLAGS = \
-include $(top_builddir)/config.h \
+ -DUDEV_ROOT_RUN=\"$(rootrundir)\" \
-DUDEV_CONF_FILE=\"$(udevconffile)\" \
-DUDEV_HWDB_BIN=\"$(udevhwdbbin)\" \
-DUDEV_VERSION=$(UDEV_VERSION) \
diff --git a/src/libudev/libudev-device-private.c b/src/libudev/libudev-device-private.c
index b7c0004563..05e772a50f 100644
--- a/src/libudev/libudev-device-private.c
+++ b/src/libudev/libudev-device-private.c
@@ -37,7 +37,7 @@ static void udev_device_tag(struct udev_device *dev, const char *tag, bool add)
id = udev_device_get_id_filename(dev);
if (id == NULL)
return;
- strscpyl(filename, sizeof(filename), "/run/udev/tags/", tag, "/", id, NULL);
+ strscpyl(filename, sizeof(filename), UDEV_ROOT_RUN "/udev/tags/", tag, "/", id, NULL);
if (add) {
int fd;
@@ -114,7 +114,7 @@ int udev_device_update_db(struct udev_device *udev_device)
return -1;
has_info = device_has_info(udev_device);
- strscpyl(filename, sizeof(filename), "/run/udev/data/", id, NULL);
+ strscpyl(filename, sizeof(filename), UDEV_ROOT_RUN "/udev/data/", id, NULL);
/* do not store anything for otherwise empty devices */
if (!has_info &&
@@ -182,7 +182,7 @@ int udev_device_delete_db(struct udev_device *udev_device)
id = udev_device_get_id_filename(udev_device);
if (id == NULL)
return -1;
- strscpyl(filename, sizeof(filename), "/run/udev/data/", id, NULL);
+ strscpyl(filename, sizeof(filename), UDEV_ROOT_RUN "/udev/data/", id, NULL);
unlink(filename);
return 0;
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index d510b47cd1..9e6a45efa6 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -610,7 +610,7 @@ static int udev_device_read_db(struct udev_device *udev_device)
if (id == NULL)
return -1;
- strscpyl(filename, sizeof(filename), "/run/udev/data/", id, NULL);
+ strscpyl(filename, sizeof(filename), UDEV_ROOT_RUN "/udev/data/", id, NULL);
f = fopen(filename, "re");
if (f == NULL)
diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c
index 1a880c2a34..7a9a5a4d3c 100644
--- a/src/libudev/libudev-enumerate.c
+++ b/src/libudev/libudev-enumerate.c
@@ -797,7 +797,7 @@ static int scan_devices_tags(struct udev_enumerate *udev_enumerate)
struct dirent *dent;
char path[UTIL_PATH_SIZE];
- strscpyl(path, sizeof(path), "/run/udev/tags/", udev_list_entry_get_name(list_entry), NULL);
+ strscpyl(path, sizeof(path), UDEV_ROOT_RUN "/udev/tags/", udev_list_entry_get_name(list_entry), NULL);
dir = opendir(path);
if (dir == NULL)
continue;
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index 55965070b1..07b23e9b35 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -170,7 +170,7 @@ struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const c
* We do not set a netlink multicast group here, so the socket
* will not receive any messages.
*/
- if (access("/run/udev/control", F_OK) < 0 && !udev_has_devtmpfs(udev)) {
+ if (access(UDEV_ROOT_RUN "/udev/control", F_OK) < 0 && !udev_has_devtmpfs(udev)) {
log_debug("the udev service seems not to be active, disable the monitor");
group = UDEV_MONITOR_NONE;
} else
diff --git a/src/libudev/libudev-queue.c b/src/libudev/libudev-queue.c
index 8ef1f3d4b0..9750057c7b 100644
--- a/src/libudev/libudev-queue.c
+++ b/src/libudev/libudev-queue.c
@@ -167,7 +167,7 @@ _public_ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *ud
**/
_public_ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue)
{
- return access("/run/udev/control", F_OK) >= 0;
+ return access(UDEV_ROOT_RUN "/udev/control", F_OK) >= 0;
}
/**
@@ -180,7 +180,7 @@ _public_ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue)
**/
_public_ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue)
{
- return access("/run/udev/queue", F_OK) < 0;
+ return access(UDEV_ROOT_RUN "/udev/queue", F_OK) < 0;
}
/**
@@ -245,7 +245,7 @@ _public_ int udev_queue_get_fd(struct udev_queue *udev_queue) {
if (fd < 0)
return -errno;
- r = inotify_add_watch(fd, "/run/udev" , IN_DELETE);
+ r = inotify_add_watch(fd, UDEV_ROOT_RUN "/udev" , IN_DELETE);
if (r < 0) {
r = -errno;
close(fd);