forked from pool/systemd
6a1d711f33
- rework patch: 1020-usb_id-some-strange-devices-have-a-very-bogus-or-strage-serial.patch - udev: use unique names for temporary files created in /dev. add: 1022-udev-use-unique-names-for-temporary-files-created-in.patch - cdrom_id: add data track count for bad virtual drive. add: 1023-cdrom_id-add-data-track-count-for-bad-virtual-drive.patch - rework patch: 1020-usb_id-some-strange-devices-have-a-very-bogus-or-strage-serial.patch - udev: use unique names for temporary files created in /dev. add: 1022-udev-use-unique-names-for-temporary-files-created-in.patch - cdrom_id: add data track count for bad virtual drive. add: 1023-cdrom_id-add-data-track-count-for-bad-virtual-drive.patch OBS-URL: https://build.opensuse.org/request/show/155319 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=344
58 lines
2.3 KiB
Diff
58 lines
2.3 KiB
Diff
Index: systemd-195/src/udev/udev-node.c
|
|
===================================================================
|
|
--- systemd-195.orig/src/udev/udev-node.c
|
|
+++ systemd-195/src/udev/udev-node.c
|
|
@@ -31,15 +31,13 @@
|
|
|
|
#include "udev.h"
|
|
|
|
-#define TMP_FILE_EXT ".udev-tmp"
|
|
-
|
|
-static int node_symlink(struct udev *udev, const char *node, const char *slink)
|
|
+static int node_symlink(struct udev_device *dev, const char *node, const char *slink)
|
|
{
|
|
struct stat stats;
|
|
char target[UTIL_PATH_SIZE];
|
|
char *s;
|
|
size_t l;
|
|
- char slink_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)];
|
|
+ char slink_tmp[UTIL_PATH_SIZE + 32];
|
|
int i = 0;
|
|
int tail = 0;
|
|
int err = 0;
|
|
@@ -101,7 +99,7 @@ static int node_symlink(struct udev *ude
|
|
}
|
|
|
|
log_debug("atomically replace '%s'\n", slink);
|
|
- util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, TMP_FILE_EXT, NULL);
|
|
+ util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, ".tmp-", udev_device_get_id_filename(dev), NULL);
|
|
unlink(slink_tmp);
|
|
do {
|
|
err = mkdir_parents_label(slink_tmp, 0755);
|
|
@@ -204,7 +202,7 @@ static void link_update(struct udev_devi
|
|
util_delete_path(udev, slink);
|
|
} else {
|
|
log_debug("creating link '%s' to '%s'\n", slink, target);
|
|
- node_symlink(udev, target, slink);
|
|
+ node_symlink(dev, target, slink);
|
|
}
|
|
|
|
if (add) {
|
|
@@ -304,7 +302,6 @@ out:
|
|
|
|
void udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid)
|
|
{
|
|
- struct udev *udev = udev_device_get_udev(dev);
|
|
char filename[UTIL_PATH_SIZE];
|
|
struct udev_list_entry *list_entry;
|
|
|
|
@@ -318,7 +315,7 @@ void udev_node_add(struct udev_device *d
|
|
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);
|
|
+ node_symlink(dev, udev_device_get_devnode(dev), filename);
|
|
|
|
/* create/update symlinks, add symlinks to name index */
|
|
udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev))
|