SHA256
1
0
forked from pool/mdadm
mdadm/policy-NULL-path-isn-t-really-acceptable-use-the-dev.patch
Neil Brown 702c57405a - mdmonitor
run "mdadm --monitor" from systemd instead of init.d
  sciprt (bnc#849523)
- remove mdadmd due to above.
- udev-rules-try-mdadm-I-on-change-events.patch
  (bnc#851993)
- policy-NULL-path-isn-t-really-acceptable-use-the-dev.patch
- DDF-really-ignore-DDF-metadata-on-partitions.patch
- Assemble-avoid-infinite-loop-when-auto-assembling-pa.patch
- DDF-fix-detection-of-failed-devices-during-assembly.patch
- Grow-fix-problems-with-prematurely-aborting-of-resha.patch
- IMSM-don-t-crash-when-creating-an-array-with-missing.patch
- mdmon-don-t-complain-about-notifying-parent-when-the.patch
- systemd-mdmon-set-IMSM_NO_PLATFORM-1.patch
- mdmon-.service-remove-over-ride-of-Standard-IO.patch
  Various upstream bug fixes.

OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=101
2014-01-22 04:59:00 +00:00

65 lines
1.9 KiB
Diff

From 75a721fd7d5e5ee7e578571fe58755fe07e446fc Mon Sep 17 00:00:00 2001
From: Lukasz Dorau <lukasz.dorau@intel.com>
Date: Thu, 19 Dec 2013 13:02:12 +0100
Subject: [PATCH 05/13] policy: NULL path isn't really acceptable - use the
devname
According to:
commit b451aa4846c5ccca5447a6b6d45e5623b8c8e961
Fix handling for "auto" line in mdadm.conf
a NULL path isn't really acceptable and the devname should be used instead.
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
policy.c | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
--- mdadm-3.3.orig/policy.c
+++ mdadm-3.3/policy.c
@@ -200,26 +200,25 @@ static char *disk_path(struct mdinfo *di
int rv;
by_path = opendir(symlink);
- if (!by_path)
- return NULL;
- prefix_len = strlen(symlink);
-
- while ((ent = readdir(by_path)) != NULL) {
- if (ent->d_type != DT_LNK)
- continue;
- strncpy(symlink + prefix_len,
- ent->d_name,
- sizeof(symlink) - prefix_len);
- if (stat(symlink, &stb) < 0)
- continue;
- if ((stb.st_mode & S_IFMT) != S_IFBLK)
- continue;
- if (stb.st_rdev != makedev(disk->disk.major, disk->disk.minor))
- continue;
+ if (by_path) {
+ prefix_len = strlen(symlink);
+ while ((ent = readdir(by_path)) != NULL) {
+ if (ent->d_type != DT_LNK)
+ continue;
+ strncpy(symlink + prefix_len,
+ ent->d_name,
+ sizeof(symlink) - prefix_len);
+ if (stat(symlink, &stb) < 0)
+ continue;
+ if ((stb.st_mode & S_IFMT) != S_IFBLK)
+ continue;
+ if (stb.st_rdev != makedev(disk->disk.major, disk->disk.minor))
+ continue;
+ closedir(by_path);
+ return xstrdup(ent->d_name);
+ }
closedir(by_path);
- return xstrdup(ent->d_name);
}
- closedir(by_path);
/* A NULL path isn't really acceptable - use the devname.. */
sprintf(symlink, "/sys/dev/block/%d:%d", disk->disk.major, disk->disk.minor);
rv = readlink(symlink, nm, sizeof(nm)-1);