Blame SOURCES/libvirt-cim-0.6.3-fb5d2fcf.patch

9c78f5
From fb5d2fcfe770d5446a6d8fcdcd405c6645c4dfb0 Mon Sep 17 00:00:00 2001
9c78f5
From: John Ferlan <jferlan@redhat.com>
9c78f5
Date: Wed, 22 Jan 2014 16:09:04 -0500
9c78f5
Subject: [PATCH 46/60] Adjust sscanf format string
9c78f5
9c78f5
Currently the sscanf() calls use "%as" or "%a[" in order to allocate and
9c78f5
return strings for read fields.  It was pointed out to me that this is an
9c78f5
older and non-portable method.  Instead the "%ms" or "%m[" should be used.
9c78f5
9c78f5
Signed-off-by: John Ferlan <jferlan@redhat.com>
9c78f5
---
9c78f5
 libxkutil/acl_parsing.c                   |  2 +-
9c78f5
 libxkutil/device_parsing.c                |  2 +-
9c78f5
 libxkutil/misc_util.c                     |  2 +-
9c78f5
 src/Virt_ComputerSystemIndication.c       |  2 +-
9c78f5
 src/Virt_Device.c                         |  6 +++---
9c78f5
 src/Virt_DevicePool.c                     |  8 ++++----
9c78f5
 src/Virt_SettingsDefineState.c            |  2 +-
9c78f5
 src/Virt_VirtualSystemManagementService.c | 12 ++++++------
9c78f5
 8 files changed, 18 insertions(+), 18 deletions(-)
9c78f5
9c78f5
diff --git a/libxkutil/acl_parsing.c b/libxkutil/acl_parsing.c
9c78f5
index 3de6a65..c368b99 100644
9c78f5
--- a/libxkutil/acl_parsing.c
9c78f5
+++ b/libxkutil/acl_parsing.c
9c78f5
@@ -666,7 +666,7 @@ int parse_rule_id(const char *rule_id, char **filter, int *index)
9c78f5
 
9c78f5
         if ((filter == NULL) || (index == NULL))
9c78f5
                 return 0;
9c78f5
-        ret = sscanf(rule_id, "%as[^:]:%u", filter, index);
9c78f5
+        ret = sscanf(rule_id, "%ms[^:]:%u", filter, index);
9c78f5
         if (ret != 2) {
9c78f5
                 free(*filter);
9c78f5
                 *filter = NULL;
9c78f5
diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
9c78f5
index 4dd9e58..c9ae886 100644
9c78f5
--- a/libxkutil/device_parsing.c
9c78f5
+++ b/libxkutil/device_parsing.c
9c78f5
@@ -1463,7 +1463,7 @@ int parse_fq_devid(const char *devid, char **host, char **device)
9c78f5
 {
9c78f5
         int ret;
9c78f5
 
9c78f5
-        ret = sscanf(devid, "%a[^/]/%a[^\n]", host, device);
9c78f5
+        ret = sscanf(devid, "%m[^/]/%m[^\n]", host, device);
9c78f5
         if (ret != 2) {
9c78f5
                 free(*host);
9c78f5
                 free(*device);
9c78f5
diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c
9c78f5
index 2164dd0..6a54815 100644
9c78f5
--- a/libxkutil/misc_util.c
9c78f5
+++ b/libxkutil/misc_util.c
9c78f5
@@ -671,7 +671,7 @@ int parse_id(const char *id,
9c78f5
         char *tmp_pfx = NULL;
9c78f5
         char *tmp_name = NULL;
9c78f5
 
9c78f5
-        ret = sscanf(id, "%a[^:]:%a[^\n]", &tmp_pfx, &tmp_name);
9c78f5
+        ret = sscanf(id, "%m[^:]:%m[^\n]", &tmp_pfx, &tmp_name);
9c78f5
         if (ret != 2) {
9c78f5
                 ret = 0;
9c78f5
                 goto out;
9c78f5
diff --git a/src/Virt_ComputerSystemIndication.c b/src/Virt_ComputerSystemIndication.c
9c78f5
index 20c60bc..32bee97 100644
9c78f5
--- a/src/Virt_ComputerSystemIndication.c
9c78f5
+++ b/src/Virt_ComputerSystemIndication.c
9c78f5
@@ -382,7 +382,7 @@ static char *sys_name_from_xml(char *xml)
9c78f5
                 goto out;
9c78f5
         }
9c78f5
 
9c78f5
-        rc = sscanf(tmp, "<name>%a[^<]s</name>", &name);
9c78f5
+        rc = sscanf(tmp, "<name>%m[^<]s</name>", &name);
9c78f5
         if (rc != 1) {
9c78f5
                 name = NULL;
9c78f5
         }
9c78f5
diff --git a/src/Virt_Device.c b/src/Virt_Device.c
9c78f5
index b93e592..12ae6bd 100644
9c78f5
--- a/src/Virt_Device.c
9c78f5
+++ b/src/Virt_Device.c
9c78f5
@@ -675,7 +675,7 @@ static CMPIStatus return_enum_devices(const CMPIObjectPath *reference,
9c78f5
 
9c78f5
         s = enum_devices(_BROKER,
9c78f5
                          reference,
9c78f5
-                         NULL, 
9c78f5
+                         NULL,
9c78f5
                          res_type_from_device_classname(CLASSNAME(reference)),
9c78f5
                          &list);
9c78f5
         if (s.rc != CMPI_RC_OK)
9c78f5
@@ -696,7 +696,7 @@ static int parse_devid(const char *devid, char **dom, char **dev)
9c78f5
 {
9c78f5
         int ret;
9c78f5
 
9c78f5
-        ret = sscanf(devid, "%a[^/]/%as", dom, dev);
9c78f5
+        ret = sscanf(devid, "%m[^/]/%ms", dom, dev);
9c78f5
         if (ret != 2) {
9c78f5
                 free(*dom);
9c78f5
                 free(*dev);
9c78f5
@@ -711,7 +711,7 @@ static int proc_dev_list(uint64_t quantity,
9c78f5
 {
9c78f5
         int i;
9c78f5
 
9c78f5
-        *list = (struct virt_device *)calloc(quantity, 
9c78f5
+        *list = (struct virt_device *)calloc(quantity,
9c78f5
                                              sizeof(struct virt_device));
9c78f5
 
9c78f5
         for (i = 0; i < quantity; i++) {
9c78f5
diff --git a/src/Virt_DevicePool.c b/src/Virt_DevicePool.c
9c78f5
index d6e51ba..aae7ed4 100644
9c78f5
--- a/src/Virt_DevicePool.c
9c78f5
+++ b/src/Virt_DevicePool.c
9c78f5
@@ -383,11 +383,11 @@ static bool _diskpool_is_member(virConnectPtr conn,
9c78f5
 
9c78f5
         pool_vol = virStoragePoolLookupByVolume(vol);
9c78f5
         if (vol != NULL) {
9c78f5
-                pool_name = virStoragePoolGetName(pool_vol);                
9c78f5
+                pool_name = virStoragePoolGetName(pool_vol);
9c78f5
                 if ((pool_name != NULL) && (STREQC(pool_name, pool->tag)))
9c78f5
                         result = true;
9c78f5
         }
9c78f5
-        
9c78f5
+
9c78f5
  out:
9c78f5
         CU_DEBUG("Image %s in pool %s: %s",
9c78f5
                  file,
9c78f5
@@ -405,7 +405,7 @@ static bool parse_diskpool_line(struct tmp_disk_pool *pool,
9c78f5
 {
9c78f5
         int ret;
9c78f5
 
9c78f5
-        ret = sscanf(line, "%as %as", &pool->tag, &pool->path);
9c78f5
+        ret = sscanf(line, "%ms %ms", &pool->tag, &pool->path);
9c78f5
         if (ret != 2) {
9c78f5
                 free(pool->tag);
9c78f5
                 free(pool->path);
9c78f5
@@ -1610,7 +1610,7 @@ CMPIStatus get_pool_by_name(const CMPIBroker *broker,
9c78f5
                 goto out;
9c78f5
         }
9c78f5
 
9c78f5
-        ret = sscanf(id, "%*[^/]/%a[^\n]", &poolid);
9c78f5
+        ret = sscanf(id, "%*[^/]/%m[^\n]", &poolid);
9c78f5
         if (ret != 1) {
9c78f5
                 cu_statusf(broker, &s,
9c78f5
                            CMPI_RC_ERR_NOT_FOUND,
9c78f5
diff --git a/src/Virt_SettingsDefineState.c b/src/Virt_SettingsDefineState.c
9c78f5
index be2ded5..c8cda97 100644
9c78f5
--- a/src/Virt_SettingsDefineState.c
9c78f5
+++ b/src/Virt_SettingsDefineState.c
9c78f5
@@ -298,7 +298,7 @@ static CMPIStatus vssd_to_vs(const CMPIObjectPath *ref,
9c78f5
                 goto out;
9c78f5
         }
9c78f5
 
9c78f5
-        ret = sscanf(id, "%a[^:]:%as", &pfx, &name);
9c78f5
+        ret = sscanf(id, "%m[^:]:%ms", &pfx, &name);
9c78f5
         if (ret != 2) {
9c78f5
                 cu_statusf(_BROKER, &s,
9c78f5
                            CMPI_RC_ERR_FAILED,
9c78f5
diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c
9c78f5
index 83e5c53..3e7785e 100644
9c78f5
--- a/src/Virt_VirtualSystemManagementService.c
9c78f5
+++ b/src/Virt_VirtualSystemManagementService.c
9c78f5
@@ -1330,7 +1330,7 @@ static int parse_console_address(const char *id,
9c78f5
 
9c78f5
         CU_DEBUG("Entering parse_console_address, address is %s", id);
9c78f5
 
9c78f5
-        ret = sscanf(id, "%a[^:]:%as", &tmp_path, &tmp_port);
9c78f5
+        ret = sscanf(id, "%m[^:]:%ms", &tmp_path, &tmp_port);
9c78f5
 
9c78f5
         if (ret != 2) {
9c78f5
                 ret = 0;
9c78f5
@@ -1366,10 +1366,10 @@ static int parse_sdl_address(const char *id,
9c78f5
 
9c78f5
         CU_DEBUG("Entering parse_sdl_address, address is %s", id);
9c78f5
 
9c78f5
-        ret = sscanf(id, "%a[^:]:%as", &tmp_xauth, &tmp_display);
9c78f5
+        ret = sscanf(id, "%m[^:]:%ms", &tmp_xauth, &tmp_display);
9c78f5
 
9c78f5
         if (ret <= 0) {
9c78f5
-                ret = sscanf(id, ":%as", &tmp_display);
9c78f5
+                ret = sscanf(id, ":%ms", &tmp_display);
9c78f5
                 if (ret <= 0) {
9c78f5
                         if (STREQC(id, ":")) {
9c78f5
                                 /* do nothing, it is empty */
9c78f5
@@ -1417,7 +1417,7 @@ static int parse_ip_address(const char *id,
9c78f5
         CU_DEBUG("Entering parse_ip_address, address is %s", id);
9c78f5
         if (strstr(id, "[") != NULL) {
9c78f5
                 /* its an ipv6 address */
9c78f5
-                ret = sscanf(id, "%a[^]]]:%as",  &tmp_ip, &tmp_port);
9c78f5
+                ret = sscanf(id, "%m[^]]]:%ms",  &tmp_ip, &tmp_port);
9c78f5
                 if (ret >= 1) {
9c78f5
                         tmp_ip = realloc(tmp_ip, strlen(tmp_ip) + 2);
9c78f5
                         if (tmp_ip == NULL) {
9c78f5
@@ -1427,7 +1427,7 @@ static int parse_ip_address(const char *id,
9c78f5
                         strcat(tmp_ip, "]");
9c78f5
                 }
9c78f5
         } else {
9c78f5
-                ret = sscanf(id, "%a[^:]:%as", &tmp_ip, &tmp_port);
9c78f5
+                ret = sscanf(id, "%m[^:]:%ms", &tmp_ip, &tmp_port);
9c78f5
         }
9c78f5
 
9c78f5
         /* ret == 2: address and port, ret == 1: address only */
9c78f5
@@ -1464,7 +1464,7 @@ static bool parse_console_url(const char *url,
9c78f5
 
9c78f5
         CU_DEBUG("Entering parse_console_url:'%s'", url);
9c78f5
 
9c78f5
-        if (sscanf(url,"%a[^:]://%as", &tmp_protocol, &tmp_address) != 2)
9c78f5
+        if (sscanf(url,"%m[^:]://%ms", &tmp_protocol, &tmp_address) != 2)
9c78f5
                 goto out;
9c78f5
 
9c78f5
         if (parse_ip_address(tmp_address, host, port) < 1)
9c78f5
-- 
9c78f5
2.1.0
9c78f5