mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-25 10:03:49 +03:00
virterror: Add virSetError
Can be used to re-set an old error, which may have been squashed by other functions (like cleanup routines). Will be used in subsequent patches
This commit is contained in:
parent
3a80f2f7ce
commit
fd5eb45b95
@ -593,6 +593,7 @@ virRaiseErrorFull;
|
||||
virReportSystemErrorFull;
|
||||
virReportOOMErrorFull;
|
||||
virStrerror;
|
||||
virSetError;
|
||||
|
||||
|
||||
# xml.h
|
||||
|
@ -289,6 +289,28 @@ virGetLastError(void)
|
||||
return err;
|
||||
}
|
||||
|
||||
/**
|
||||
* virSetError:
|
||||
*
|
||||
* Set the current error from a previously saved error object
|
||||
*
|
||||
* Can be used to re-set an old error, which may have been squashed by
|
||||
* other functions (like cleanup routines).
|
||||
*
|
||||
* Returns 0 on success, 1 on failure
|
||||
*/
|
||||
int
|
||||
virSetError(virErrorPtr newerr)
|
||||
{
|
||||
virErrorPtr err;
|
||||
err = virGetLastError();
|
||||
if (!err)
|
||||
return -1;
|
||||
|
||||
virResetError(err);
|
||||
return virCopyError(newerr, err);
|
||||
}
|
||||
|
||||
/**
|
||||
* virCopyLastError:
|
||||
* @to: target to receive the copy
|
||||
|
@ -90,6 +90,7 @@ void virReportOOMErrorFull(virConnectPtr conn,
|
||||
__FILE__, __FUNCTION__, __LINE__)
|
||||
|
||||
|
||||
int virSetError(virErrorPtr newerr);
|
||||
void virDispatchError(virConnectPtr conn);
|
||||
const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user