Skip to contentSkip to conversation

multipath-tools: fix a porting bug for random libprio

PATCH New Kiyoshi Ueda 1 participant 1 message Dec 20, 2007 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multipath-tools: fix a porting bug for random libprio

Hi Christophe,

The random prioritizer were not converted to the new scheme. It should return the priority instead of print it.

libprio/random.c +3 -2
@@ -7,10 +7,11 @@
 
 int prio_random(struct path * pp)
 {
+	int ret;
 	struct timeval tv;
 	
 	gettimeofday(&tv, NULL);
 	srand((unsigned int)tv.tv_usec);
-	printf("%i\n", 1+(int) (10.0*rand()/(RAND_MAX+1.0)));
-	return 0;
+	ret = 1 + (int)(10.0 * rand() / (RAND_MAX + 1.0));
+	return ret;
 }

Thanks,
Kiyoshi Ueda