'qemuMonitorRemoveFdset' validatest 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(a)redhat.com>
---
src/qemu/qemu_monitor.c | 14 ++++----------
src/qemu/qemu_monitor.h | 2 +-
src/qemu/qemu_monitor_json.c | 4 ++--
src/qemu/qemu_monitor_json.h | 2 +-
4 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index fcd39b80c6..7915729cbb 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2556,24 +2556,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);
}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index efc4721ea9..27e288c724 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -974,7 +974,7 @@ qemuMonitorAddFileHandleToSet(qemuMonitor *mon,
int
qemuMonitorRemoveFdset(qemuMonitor *mon,
- int fdset);
+ unsigned int fdset);
typedef struct _qemuMonitorFdsetFdInfo qemuMonitorFdsetFdInfo;
struct _qemuMonitorFdsetFdInfo {
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 69ecc8a2d1..acecdc3943 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -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)
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 309d1fb409..eea3478af0 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -257,7 +257,7 @@ qemuMonitorJSONAddFileHandleToSet(qemuMonitor *mon,
int
qemuMonitorJSONRemoveFdset(qemuMonitor *mon,
- int fdset);
+ unsigned int fdset);
int
qemuMonitorJSONQueryFdsets(qemuMonitor *mon,
--
2.34.1