device-mapper-multipath/0015-RH-fix-output-buffer.patch
Benjamin Marzinski aba856f28c device-mapper-multipath-0.4.9-55
Modify 0015-RH-fix-output-buffer.patch
  * Fix memory leak
Add 0048-RH-print-defaults.patch
Add 0049-RH-remove-ID_FS_TYPE.patch
  * remove ID_FS_TYPE udev enviroment variable for multipath devices
Add 0051-UP-fix-cli-resize.patch
  * check before dereferencing variables
Add 0052-RH-fix-bad-derefs.patch
  * setup multipath free the multipath device when it fails, so don't keep
    using it.
Add 0053-UP-fix-failback.patch
  * setting failback in the devices section was broken
Add 0054-UP-keep-udev-ref.patch
  * multipathd needs to keep the same udev object across reconfigures
Add 0055-UP-handle-quiesced-paths.patch
  * quiesced paths should be treated as down
Add 0056-UP-alua-prio-fix.patch
  * Don't count the preferred bit for paths that are active/optimized
Add 0057-UP-fix-tmo.patch
  * Cleanup how multipath sets dev_loss_tmo and fast_io_fail_tmo.  Also
    make multipath get changing values directly from sysfs, instead of
    from udev, which caches them.
Add 0058-UP-fix-failback.patch
  * make failback print the default value when you show configs.
Add 0059-UP-flush-failure-queueing.patch
  * If you can't flush a multipath device, restore the queue_if_no_paths
    value
Add 0060-UP-uevent-loop-udev.patch
  * make ueventloop grab it's own udev reference, since it is cancelled
    asychnrously.
2013-07-25 10:15:48 -05:00

63 lines
1.5 KiB
Diff

---
libmultipath/print.c | 31 +++++++++++++++++++++++++++----
1 file changed, 27 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,12 +757,32 @@ 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);
+ FREE(buff);
}
extern int