summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rw-r--r--extras/collect/collect.c19
-rw-r--r--extras/firmware/firmware.c2
-rw-r--r--extras/rule_generator/rule_generator.functions8
3 files changed, 20 insertions, 9 deletions
diff --git a/extras/collect/collect.c b/extras/collect/collect.c
index b5670516b4..17b3df372f 100644
--- a/extras/collect/collect.c
+++ b/extras/collect/collect.c
@@ -34,7 +34,6 @@
#include "libudev.h"
#include "libudev-private.h"
-#define TMPFILE "/dev/.run/udev/collect"
#define BUFSIZE 16
#define UDEV_ALARM_TIMEOUT 180
@@ -338,6 +337,7 @@ static void everybody(void)
int main(int argc, char **argv)
{
+ struct udev *udev;
static const struct option options[] = {
{ "add", no_argument, NULL, 'a' },
{ "remove", no_argument, NULL, 'r' },
@@ -349,8 +349,15 @@ int main(int argc, char **argv)
char *checkpoint, *us;
int fd;
int i;
- int ret = 0;
+ int ret = EXIT_SUCCESS;
int prune = 0;
+ char tmpdir[UTIL_PATH_SIZE];
+
+ udev = udev_new();
+ if (udev == NULL) {
+ ret = EXIT_FAILURE;
+ goto exit;
+ }
while (1) {
int option;
@@ -398,7 +405,8 @@ int main(int argc, char **argv)
if (debug)
fprintf(stderr, "Using checkpoint '%s'\n", checkpoint);
- fd = prepare(TMPFILE, checkpoint);
+ util_strscpyl(tmpdir, sizeof(tmpdir), udev_get_run_path(udev), "/collect", NULL);
+ fd = prepare(tmpdir, checkpoint);
if (fd < 0) {
ret = 3;
goto out;
@@ -454,11 +462,12 @@ int main(int argc, char **argv)
lockf(fd, F_ULOCK, 0);
close(fd);
- out:
+out:
if (debug)
everybody();
if (ret >= 0)
printf("COLLECT_%s=%d\n", checkpoint, ret);
- exit:
+exit:
+ udev_unref(udev);
return ret;
}
diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c
index f7d21df6d0..81998201b2 100644
--- a/extras/firmware/firmware.c
+++ b/extras/firmware/firmware.c
@@ -147,7 +147,7 @@ int main(int argc, char **argv)
}
util_path_encode(firmware, fwencpath, sizeof(fwencpath));
- util_strscpyl(misspath, sizeof(misspath), udev_get_dev_path(udev), "/.run/udev/firmware-missing/", fwencpath, NULL);
+ util_strscpyl(misspath, sizeof(misspath), udev_get_run_path(udev), "/firmware-missing/", fwencpath, NULL);
util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL);
if (fwfile == NULL) {
diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions
index e2060a2ece..4bec27a1b7 100644
--- a/extras/rule_generator/rule_generator.functions
+++ b/extras/rule_generator/rule_generator.functions
@@ -48,9 +48,10 @@ writeable() {
# Create a lock file for the current rules file.
lock_rules_file() {
- [ -e /dev/.udev/ ] || return 0
+ RUNDIR=$(udevadm info --run)
+ [ -e "$RUNDIR" ] || return 0
- RULES_LOCK="/dev/.udev/.lock-${RULES_FILE##*/}"
+ RULES_LOCK="$RUNDIR/.lock-${RULES_FILE##*/}"
retry=30
while ! mkdir $RULES_LOCK 2> /dev/null; do
@@ -71,7 +72,8 @@ unlock_rules_file() {
# Choose the real rules file if it is writeable or a temporary file if not.
# Both files should be checked later when looking for existing rules.
choose_rules_file() {
- local tmp_rules_file="/dev/.udev/tmp-rules--${RULES_FILE##*/}"
+ RUNDIR=$(udevadm info --run)
+ local tmp_rules_file="$RUNDIR/tmp-rules--${RULES_FILE##*/}"
[ -e "$RULES_FILE" -o -e "$tmp_rules_file" ] || PRINT_HEADER=1
if writeable ${RULES_FILE%/*}; then