Skip to contentSkip to conversation

multipath compilation fixes

PATCH New Hannes Reinecke 1 participant 1 message Dec 9, 2005 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multipath compilation fixes

Hi Christophe,

dm_mapname returns a strdup()ed string, which does not really qualify as const. This patchs corrects it.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke			[email protected]
SuSE Linux Products GmbH		S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de

[devmapper] Compilation fixes

As we're returning a strdup()ed string from dm_mapname() it hardly qualifies as 'const'.

kpartx/devmapper.c +3 -2
@@ -119,11 +119,12 @@ out:
 }
 
 
-const char *
+char *
 dm_mapname(int major, int minor)
 {
 	struct dm_task *dmt;
-	const char *mapname = NULL, *map;
+	char *mapname = NULL;
+	const char *map;
 
 	if (!(dmt = dm_task_create(DM_DEVICE_INFO)))
 		return NULL;
kpartx/devmapper.h +1 -1
@@ -2,5 +2,5 @@ int dm_prereq (char *, int, int, int);
 int dm_simplecmd (int, const char *);
 int dm_addmap (int, const char *, const char *, const char *, unsigned long);
 int dm_map_present (char *);
-const char * dm_mapname(int major, int minor);
+char * dm_mapname(int major, int minor);
 dev_t dm_get_first_dep(char *devname);
libmultipath/devmapper.c +2 -1
@@ -675,7 +675,8 @@ out:
 char *
 dm_mapname(int major, int minor)
 {
-	char * response = NULL, *map;
+	char * response = NULL;
+	const char *map;
 	struct dm_task *dmt;
 	int r;
 	int loop = MAX_WAIT * LOOPS_PER_SEC;