render / rpms / libvirt

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