diff options
author | Kay Sievers <kay@vrfy.org> | 2012-07-15 22:10:46 +0200 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2012-07-15 22:10:46 +0200 |
commit | 4cb72937d3c10948e4904388ea27efae75775f08 (patch) | |
tree | bf7feaedf35aece23c30365747e75204b762ba60 /src/udev/udev-node.c | |
parent | cf3fb69acba245356022ccc087da640a6093584d (diff) |
udev: get rid of TEST_PREFIX and use unshare() to fake /sys, /dev, /run
Diffstat (limited to 'src/udev/udev-node.c')
-rw-r--r-- | src/udev/udev-node.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c index 9add76547f..738d02fa25 100644 --- a/src/udev/udev-node.c +++ b/src/udev/udev-node.c @@ -190,8 +190,8 @@ static void link_update(struct udev_device *dev, const char *slink, bool add) const char *target; char buf[UTIL_PATH_SIZE]; - util_path_encode(slink + strlen(TEST_PREFIX "/dev"), name_enc, sizeof(name_enc)); - util_strscpyl(dirname, sizeof(dirname), TEST_PREFIX "/run/udev/links/", name_enc, NULL); + util_path_encode(slink + strlen("/dev"), name_enc, sizeof(name_enc)); + util_strscpyl(dirname, sizeof(dirname), "/run/udev/links/", name_enc, NULL); util_strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL); if (!add && unlink(filename) == 0) @@ -315,7 +315,7 @@ void udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) return; /* always add /dev/{block,char}/$major:$minor */ - snprintf(filename, sizeof(filename), TEST_PREFIX "/dev/%s/%u:%u", + snprintf(filename, sizeof(filename), "/dev/%s/%u:%u", strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); node_symlink(udev, udev_device_get_devnode(dev), filename); @@ -340,7 +340,7 @@ void udev_node_remove(struct udev_device *dev) link_update(dev, udev_list_entry_get_name(list_entry), 0); /* remove /dev/{block,char}/$major:$minor */ - snprintf(filename, sizeof(filename), TEST_PREFIX "/dev/%s/%u:%u", + snprintf(filename, sizeof(filename), "/dev/%s/%u:%u", strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); unlink(filename); |