404507
From e1925c70ae31799e0c829ffee5afe88546cd000d Mon Sep 17 00:00:00 2001
404507
Message-Id: <e1925c70ae31799e0c829ffee5afe88546cd000d@dist-git>
404507
From: Jiri Denemark <jdenemar@redhat.com>
404507
Date: Wed, 22 Nov 2017 10:28:35 +0100
404507
Subject: [PATCH] vierror: Define VIR_ERROR_MAX_LENGTH macro
404507
404507
And use it instead of a magic 1024 constant.
404507
404507
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
404507
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
404507
(cherry picked from commit c88ce8ae740165ffcf3cb172c6950ffe0c3a7b3b)
404507
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1335534
404507
404507
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
404507
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
404507
---
404507
 src/util/virerror.c | 6 +++---
404507
 src/util/virerror.h | 2 ++
404507
 2 files changed, 5 insertions(+), 3 deletions(-)
404507
404507
diff --git a/src/util/virerror.c b/src/util/virerror.c
404507
index 1f15c5dbbe..91022c3b63 100644
404507
--- a/src/util/virerror.c
404507
+++ b/src/util/virerror.c
404507
@@ -1480,7 +1480,7 @@ void virReportErrorHelper(int domcode,
404507
 {
404507
     int save_errno = errno;
404507
     va_list args;
404507
-    char errorMessage[1024];
404507
+    char errorMessage[VIR_ERROR_MAX_LENGTH];
404507
     const char *virerr;
404507
 
404507
     if (fmt) {
404507
@@ -1541,8 +1541,8 @@ void virReportSystemErrorFull(int domcode,
404507
                               const char *fmt, ...)
404507
 {
404507
     int save_errno = errno;
404507
-    char strerror_buf[1024];
404507
-    char msgDetailBuf[1024];
404507
+    char strerror_buf[VIR_ERROR_MAX_LENGTH];
404507
+    char msgDetailBuf[VIR_ERROR_MAX_LENGTH];
404507
 
404507
     const char *errnoDetail = virStrerror(theerrno, strerror_buf,
404507
                                           sizeof(strerror_buf));
404507
diff --git a/src/util/virerror.h b/src/util/virerror.h
404507
index 3201d5cec6..77f6340dc8 100644
404507
--- a/src/util/virerror.h
404507
+++ b/src/util/virerror.h
404507
@@ -24,6 +24,8 @@
404507
 
404507
 # include "internal.h"
404507
 
404507
+# define VIR_ERROR_MAX_LENGTH 1024
404507
+
404507
 extern virErrorFunc virErrorHandler;
404507
 extern void *virUserData;
404507
 
404507
-- 
404507
2.15.0
404507