From c88ce8ae740165ffcf3cb172c6950ffe0c3a7b3b Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Wed, 22 Nov 2017 10:28:35 +0100 Subject: [PATCH] vierror: Define VIR_ERROR_MAX_LENGTH macro And use it instead of a magic 1024 constant. Signed-off-by: Jiri Denemark Reviewed-by: Pavel Hrdina --- 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; -- GitLab