]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuMonitorRemoveFdset: Convert @fdset to unsigned int to avoid error
authorPeter Krempa <pkrempa@redhat.com>
Mon, 24 Jan 2022 14:58:37 +0000 (15:58 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 14 Feb 2022 12:13:59 +0000 (13:13 +0100)
'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>
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.h

index 95ed6199b19f11768b82abff517016e191f4aad9..3de04eb1ccd82ca42648ad14da9a82287707d882 100644 (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 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);
 }
 
index efc4721ea98a512350632fe7316d2ba2ecb9ba44..27e288c724b55fcd42eb92619e85d4c4565fba56 100644 (file)
@@ -974,7 +974,7 @@ qemuMonitorAddFileHandleToSet(qemuMonitor *mon,
 
 int
 qemuMonitorRemoveFdset(qemuMonitor *mon,
-                       int fdset);
+                       unsigned int fdset);
 
 typedef struct _qemuMonitorFdsetFdInfo qemuMonitorFdsetFdInfo;
 struct _qemuMonitorFdsetFdInfo {
index 69ecc8a2d191f00b61f631a6feccc64cf1b6e09f..acecdc3943aae9844b3305f005aaea4457c2f6f0 100644 (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)
index 309d1fb409e77bbd2b18f68ee1a5c754a826b94c..eea3478af039311f8c7eb7b48fb8e75703797ba3 100644 (file)
@@ -257,7 +257,7 @@ qemuMonitorJSONAddFileHandleToSet(qemuMonitor *mon,
 
 int
 qemuMonitorJSONRemoveFdset(qemuMonitor *mon,
-                           int fdset);
+                           unsigned int fdset);
 
 int
 qemuMonitorJSONQueryFdsets(qemuMonitor *mon,