[PATCH 2/3] vierror: Define VIR_ERROR_MAX_LENGTH macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



And use it instead of a magic 1024 constant.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/util/virerror.c | 6 +++---
 src/util/virerror.h | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/util/virerror.c b/src/util/virerror.c
index 1f15c5dbbe..91022c3b63 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -1480,7 +1480,7 @@ void virReportErrorHelper(int domcode,
 {
     int save_errno = errno;
     va_list args;
-    char errorMessage[1024];
+    char errorMessage[VIR_ERROR_MAX_LENGTH];
     const char *virerr;
 
     if (fmt) {
@@ -1541,8 +1541,8 @@ void virReportSystemErrorFull(int domcode,
                               const char *fmt, ...)
 {
     int save_errno = errno;
-    char strerror_buf[1024];
-    char msgDetailBuf[1024];
+    char strerror_buf[VIR_ERROR_MAX_LENGTH];
+    char msgDetailBuf[VIR_ERROR_MAX_LENGTH];
 
     const char *errnoDetail = virStrerror(theerrno, strerror_buf,
                                           sizeof(strerror_buf));
diff --git a/src/util/virerror.h b/src/util/virerror.h
index fba18ba589..cf434f45fc 100644
--- a/src/util/virerror.h
+++ b/src/util/virerror.h
@@ -24,6 +24,8 @@
 
 # include "internal.h"
 
+# define VIR_ERROR_MAX_LENGTH 1024
+
 extern virErrorFunc virErrorHandler;
 extern void *virUserData;
 
-- 
2.15.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux