Fixup %n to handle '!' special case
authorHannes Reinecke <hare@suse.de>
Wed, 29 Oct 2008 15:58:52 +0000 (16:58 +0100)
committerChristophe Varoqui <christophe.varoqui@free.fr>
Tue, 21 Apr 2009 21:36:58 +0000 (23:36 +0200)
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

index a0f74e9..520343e 100644 (file)
@@ -148,6 +148,7 @@ apply_format (char * string, char * cmd, struct path * pp)
        char * pos;
        char * dst;
        char * p;
+       char * q;
        int len;
        int myfree;
 
@@ -186,6 +187,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':