device-mapper-multipath/0015-RH-fix-output-buffer.patch
Benjamin Marzinski d1207a7795 device-mapper-multipath-0.4.9-45
Updated to latest upstrem 0.4.9 code: multipath-tools-130222
  (git commit id: 67b82ad6fe280caa1770025a6bb8110b633fa136)
Refresh 0001-RH-dont_start_with_no_config.patch
Modify 0002-RH-multipath.rules.patch
Modify 0003-RH-Make-build-system-RH-Fedora-friendly.patch
Refresh 0004-RH-multipathd-blacklist-all-by-default.patch
Refresh 0005-RH-add-mpathconf.patch
Refresh 0006-RH-add-find-multipaths.patch
Add 0008-RH-revert-partition-changes.patch
Rename 0008-RH-RHEL5-style-partitions.patch to
       0009-RH-RHEL5-style-partitions.patch
Rename 0009-RH-dont-remove-map-on-enomem.patch to
       0010-RH-dont-remove-map-on-enomem.patch
Rename 0010-RH-deprecate-uid-gid-mode.patch to
       0011-RH-deprecate-uid-gid-mode.patch
Rename 0013-RH-kpartx-msg.patch to 0012-RH-kpartx-msg.patch
Rename 0035-RHBZ-883981-cleanup-rpmdiff-issues.patch to
       0013-RHBZ-883981-cleanup-rpmdiff-issues.patch
Rename 0039-RH-handle-other-sector-sizes.patch to
       0014-RH-handle-other-sector-sizes.patch
Rename 0040-RH-fix-output-buffer.patch to 0015-RH-fix-output-buffer.patch
Add 0016-RH-dont-print-ghost-messages.patch
Add 0017-RH-fix-sigusr1.patch
  * Actually this fixes a number of issues related to signals
Rename 0018-RH-remove-config-dups.patch to 0018-RH-fix-factorize.patch
  * just the part that isn't upstream
Add 0019-RH-fix-sockets.patch
  * makes abstract multipathd a cli sockets use the correct name.
Set find_multipaths in the default config
2013-03-02 17:03:30 -06:00

61 lines
1.5 KiB
Diff

---
libmultipath/print.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
Index: multipath-tools-130222/libmultipath/print.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/print.c
+++ multipath-tools-130222/libmultipath/print.c
@@ -8,6 +8,8 @@
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
+#include <string.h>
+#include <errno.h>
#include "checkers.h"
#include "vector.h"
@@ -24,6 +26,7 @@
#include "switchgroup.h"
#include "devmapper.h"
#include "uevent.h"
+#include "debug.h"
#define MAX(x,y) (x > y) ? x : y
#define TAIL (line + len - 1 - c)
@@ -754,11 +757,30 @@ snprint_pathgroup (char * line, int len,
extern void
print_multipath_topology (struct multipath * mpp, int verbosity)
{
- char buff[MAX_LINE_LEN * MAX_LINES] = {};
+ int resize;
+ char *buff = NULL;
+ char *old = NULL;
+ int len, maxlen = MAX_LINE_LEN * MAX_LINES;
- memset(&buff[0], 0, MAX_LINE_LEN * MAX_LINES);
- snprint_multipath_topology(&buff[0], MAX_LINE_LEN * MAX_LINES,
- mpp, verbosity);
+ buff = MALLOC(maxlen);
+ do {
+ if (!buff) {
+ if (old)
+ FREE(old);
+ condlog(0, "couldn't allocate memory for list: %s\n",
+ strerror(errno));
+ return;
+ }
+
+ len = snprint_multipath_topology(buff, maxlen, mpp, verbosity);
+ resize = (len == maxlen - 1);
+
+ if (resize) {
+ maxlen *= 2;
+ old = buff;
+ buff = REALLOC(buff, maxlen);
+ }
+ } while (resize);
printf("%s", buff);
}