diff options
-rw-r--r-- | debian/patches/debian/0004-exit-gracefully-when-md-device-not-found.patch | 23 | ||||
-rw-r--r-- | debian/patches/exit-gracefully-when-md-device-not-found.patch | 25 | ||||
-rw-r--r-- | debian/patches/series | 2 |
3 files changed, 24 insertions, 26 deletions
diff --git a/debian/patches/debian/0004-exit-gracefully-when-md-device-not-found.patch b/debian/patches/debian/0004-exit-gracefully-when-md-device-not-found.patch new file mode 100644 index 0000000..c580449 --- /dev/null +++ b/debian/patches/debian/0004-exit-gracefully-when-md-device-not-found.patch @@ -0,0 +1,23 @@ +Author: Felix Lechner <felix.lechner@lease-up.com> +Description: Exit gracefully when md device not found (Closes: #970329). + +diff -Naurp mdadm.orig/Monitor.c mdadm/Monitor.c +--- mdadm.orig/Monitor.c ++++ mdadm/Monitor.c +@@ -554,8 +554,14 @@ static int check_array(struct state *st, + if (fd < 0) + goto disappeared; + +- if (st->devnm[0] == 0) +- snprintf(st->devnm, MD_NAME_MAX, "%s", fd2devnm(fd)); ++ if (st->devnm[0] == 0) { ++ char *found = fd2devnm(fd); ++ if (!found) { ++ alert("DeviceDisappeared", dev, NULL, ainfo); ++ goto out; ++ } ++ snprintf(st->devnm, MD_NAME_MAX, "%s", found); ++ } + + for (mse2 = mdstat; mse2; mse2 = mse2->next) + if (strcmp(mse2->devnm, st->devnm) == 0) { diff --git a/debian/patches/exit-gracefully-when-md-device-not-found.patch b/debian/patches/exit-gracefully-when-md-device-not-found.patch deleted file mode 100644 index c6a34d5..0000000 --- a/debian/patches/exit-gracefully-when-md-device-not-found.patch +++ /dev/null @@ -1,25 +0,0 @@ -Description: Exit gracefully when md device not found -Author: Felix Lechner <felix.lechner@lease-up.com> -Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=970329 -Forwarded: no ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ ---- a/Monitor.c -+++ b/Monitor.c -@@ -539,8 +539,14 @@ static int check_array(struct state *st, - if (fd < 0) - goto disappeared; - -- if (st->devnm[0] == 0) -- strcpy(st->devnm, fd2devnm(fd)); -+ if (st->devnm[0] == 0) { -+ char *found = fd2devnm(fd); -+ if (!found) { -+ alert("DeviceDisappeared", dev, NULL, ainfo); -+ goto out; -+ } -+ strcpy(st->devnm, found); -+ } - - for (mse2 = mdstat; mse2; mse2 = mse2->next) - if (strcmp(mse2->devnm, st->devnm) == 0) { diff --git a/debian/patches/series b/debian/patches/series index f779685..d368285 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,7 +1,7 @@ debian/0001-fix-manpages.patch debian/0002-mdmonitor-service-simplify.patch debian/0003-host-name-in-default-mailfrom.patch -exit-gracefully-when-md-device-not-found.patch +debian/0004-exit-gracefully-when-md-device-not-found.patch sha1-includes.diff readlink-path.patch debian-no-Werror.diff |