qemuMonitorRemoveFdset: Convert @fdset to unsigned int to avoid error

'qemuMonitorRemoveFdset' validates that the 'fdset' argument isn't less
than 0. We can turn it to unsigned and thus avoid the error message
completely.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-01-24 15:58:37 +01:00
parent 6e433cc8df
commit b25f2a2192
4 changed files with 8 additions and 14 deletions

View File

@ -2553,24 +2553,18 @@ qemuMonitorAddFileHandleToSet(qemuMonitor *mon,
/**
* qemuMonitorRemoveFdset:
* @mon: monitor object
* @fdset: the fdset to remove
* @fdset: id of the fdset to remove
*
* Attempts to remove a fdset from qemu and close associated file descriptors
* Attempts to remove @fdset from qemu and close associated file descriptors
* Returns 0 if ok, and -1 on failure */
int
qemuMonitorRemoveFdset(qemuMonitor *mon,
int fdset)
unsigned int fdset)
{
VIR_DEBUG("fdset=%d", fdset);
VIR_DEBUG("fdset=%u", fdset);
QEMU_CHECK_MONITOR(mon);
if (fdset < 0) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("fdset must be valid"));
return -1;
}
return qemuMonitorJSONRemoveFdset(mon, fdset);
}

View File

@ -974,7 +974,7 @@ qemuMonitorAddFileHandleToSet(qemuMonitor *mon,
int
qemuMonitorRemoveFdset(qemuMonitor *mon,
int fdset);
unsigned int fdset);
typedef struct _qemuMonitorFdsetFdInfo qemuMonitorFdsetFdInfo;
struct _qemuMonitorFdsetFdInfo {

View File

@ -3766,11 +3766,11 @@ int qemuMonitorJSONQueryFdsets(qemuMonitor *mon,
int qemuMonitorJSONRemoveFdset(qemuMonitor *mon,
int fdset)
unsigned int fdset)
{
g_autoptr(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) cmd = qemuMonitorJSONMakeCommand("remove-fd",
"i:fdset-id", fdset,
"u:fdset-id", fdset,
NULL);
if (!cmd)

View File

@ -257,7 +257,7 @@ qemuMonitorJSONAddFileHandleToSet(qemuMonitor *mon,
int
qemuMonitorJSONRemoveFdset(qemuMonitor *mon,
int fdset);
unsigned int fdset);
int
qemuMonitorJSONQueryFdsets(qemuMonitor *mon,