mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
Convert virSecurityReportError into a macro
The virRaiseError macro inside of virSecurityReportError expands to virRaiseErrorFull and includes the __FILE__, __FUNCTION__ and __LINE__ information. But this three values are always the same for every call to virSecurityReportError and do not reflect the actual error context. Converting virSecurityReportError into a macro results in getting the correct __FILE__, __FUNCTION__ and __LINE__ information.
This commit is contained in:
parent
141dea6bc7
commit
cad2a4caed
@ -90,24 +90,6 @@ virSecurityDriverStartup(virSecurityDriverPtr *drv,
|
||||
return -2;
|
||||
}
|
||||
|
||||
void
|
||||
virSecurityReportError(int code, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char errorMessage[1024];
|
||||
|
||||
if (fmt) {
|
||||
va_start(args, fmt);
|
||||
vsnprintf(errorMessage, sizeof(errorMessage) - 1, fmt, args);
|
||||
va_end(args);
|
||||
} else
|
||||
errorMessage[0] = '\0';
|
||||
|
||||
virRaiseError(NULL, NULL, NULL, VIR_FROM_SECURITY, code,
|
||||
VIR_ERR_ERROR, NULL, NULL, NULL, -1, -1, "%s",
|
||||
errorMessage);
|
||||
}
|
||||
|
||||
/*
|
||||
* Helpers
|
||||
*/
|
||||
|
@ -88,9 +88,9 @@ int virSecurityDriverStartup(virSecurityDriverPtr *drv,
|
||||
int
|
||||
virSecurityDriverVerify(virDomainDefPtr def);
|
||||
|
||||
void
|
||||
virSecurityReportError(int code, const char *fmt, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
#define virSecurityReportError(code, fmt...) \
|
||||
virReportErrorHelper(NULL, VIR_FROM_SECURITY, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, fmt)
|
||||
|
||||
/* Helpers */
|
||||
void virSecurityDriverInit(virSecurityDriverPtr drv);
|
||||
|
Loading…
x
Reference in New Issue
Block a user