]> xenbits.xensource.com Git - libvirt.git/commitdiff
vierror: Define VIR_ERROR_MAX_LENGTH macro
authorJiri Denemark <jdenemar@redhat.com>
Wed, 22 Nov 2017 09:28:35 +0000 (10:28 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 23 Nov 2017 13:06:40 +0000 (14:06 +0100)
And use it instead of a magic 1024 constant.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/util/virerror.c
src/util/virerror.h

index 1f15c5dbbea8114feea2113177d104d221f6b0c8..91022c3b6352b5431bc9f437114b8fc10b85f6de 100644 (file)
@@ -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));
index fba18ba5898519a37ba39983aaccf29cc62f5cf6..cf434f45fca9cbb6d8b764e5089491cbab5fca91 100644 (file)
@@ -24,6 +24,8 @@
 
 # include "internal.h"
 
+# define VIR_ERROR_MAX_LENGTH 1024
+
 extern virErrorFunc virErrorHandler;
 extern void *virUserData;