File multipath-tools-sysfs-subdir-reformat of Package multipath-tools

From ac44cbe83f16eafc3de5a56fa275aabd5783ce7c Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 29 Oct 2008 16:58:52 +0100
Subject: [PATCH] Fixup %n to handle '!' special case

The kernel name may contain an '!', which should be translated
into a '/'. So do it here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/callout.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/libmultipath/callout.c b/libmultipath/callout.c
index 4dd33c5..59ac694 100644
--- a/libmultipath/callout.c
+++ b/libmultipath/callout.c
@@ -131,6 +131,7 @@ apply_format (char * string, char * cmd, struct path * pp)
 	char * pos;
 	char * dst;
 	char * p;
+	char * q;
 	int len;
 	int myfree;
 
@@ -169,6 +170,10 @@ apply_format (char * string, char * cmd, struct path * pp)
 			return 1;
 
 		snprintf(p, len, "%s", pp->dev);
+		for (q = p; q < p + len; q++) {
+			if (q && *q == '!')
+				*q = '/';
+		}
 		p += len - 1;
 		break;
 	case 'd':
-- 
1.5.4.5

openSUSE Build Service is sponsored by