[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] [PATCH 2/2] [multipath-tools] Additional fixes for inconsistent quoting in snprint functions



This patch finishes the job from this commit: http://git.opensvc.com/gitweb.cgi?p=multipath-tools/.git;a=commitdiff;h=cef43b6f910f740c0e2d38761f58c5ebedfb7585;hp=41b85341ca514a50d18c592996a2ecb43a81fa90
All attributes printing strings from their snprint functions should now be quotes.

Signed-off-by: Sean Stewart <Sean Stewart netapp com>

---
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index a54dda9..5154cdd 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -1883,11 +1883,11 @@ snprint_mp_failback (char * buff, int len, void * data)
        case  FAILBACK_UNDEF:
                break;
        case -FAILBACK_MANUAL:
-               return snprintf(buff, len, "manual");
+               return snprintf(buff, len, "\"manual\"");
        case -FAILBACK_IMMEDIATE:
-               return snprintf(buff, len, "immediate");
+               return snprintf(buff, len, "\"immediate\"");
        case -FAILBACK_FOLLOWOVER:
-               return snprintf(buff, len, "followover");
+               return snprintf(buff, len, "\"followover\"");
        default:
                return snprintf(buff, len, "%i", mpe->pgfailback);
        }
@@ -2078,9 +2078,9 @@ snprint_mp_user_friendly_names (char * buff, int len, void * data)
        if (mpe->user_friendly_names == USER_FRIENDLY_NAMES_UNDEF)
                return 0;
        else if (mpe->user_friendly_names == USER_FRIENDLY_NAMES_OFF)
-               return snprintf(buff, len, "no");
+               return snprintf(buff, len, "\"no\"");
        else
-               return snprintf(buff, len, "yes");
+               return snprintf(buff, len, "\"yes\"");
 }

 static int
@@ -2260,11 +2260,11 @@ snprint_hw_failback (char * buff, int len, void * data)
        case  FAILBACK_UNDEF:
                break;
        case -FAILBACK_MANUAL:
-               return snprintf(buff, len, "manual");
+               return snprintf(buff, len, "\"manual\"");
        case -FAILBACK_IMMEDIATE:
-               return snprintf(buff, len, "immediate");
+               return snprintf(buff, len, "\"immediate\"");
        case -FAILBACK_FOLLOWOVER:
-               return snprintf(buff, len, "followover");
+               return snprintf(buff, len, "\"followover\"");
        default:
                return snprintf(buff, len, "%i", hwe->pgfailback);
        }
@@ -2382,9 +2382,9 @@ snprint_hw_user_friendly_names (char * buff, int len, void * data)
        if (hwe->user_friendly_names == USER_FRIENDLY_NAMES_UNDEF)
                return 0;
        else if (hwe->user_friendly_names == USER_FRIENDLY_NAMES_OFF)
-               return snprintf(buff, len, "no");
+               return snprintf(buff, len, "\"no\"");
        else
-               return snprintf(buff, len, "yes");
+               return snprintf(buff, len, "\"yes\"");
 }

 static int
@@ -2393,9 +2393,9 @@ snprint_hw_retain_hwhandler_handler(char * buff, int len, void * data)
        struct hwentry * hwe = (struct hwentry *)data;

        if (hwe->retain_hwhandler == RETAIN_HWHANDLER_ON)
-               return snprintf(buff, len, "yes");
+               return snprintf(buff, len, "\"yes\"");
        else if (hwe->retain_hwhandler == RETAIN_HWHANDLER_OFF)
-               return snprintf(buff, len, "no");
+               return snprintf(buff, len, "\"no\"");
        else
                return 0;
 }
@@ -2406,9 +2406,9 @@ snprint_detect_prio(char * buff, int len, void * data)
        struct hwentry * hwe = (struct hwentry *)data;

        if (hwe->detect_prio == DETECT_PRIO_ON)
-               return snprintf(buff, len, "yes");
+               return snprintf(buff, len, "\"yes\"");
        else if (hwe->detect_prio == DETECT_PRIO_OFF)
-               return snprintf(buff, len, "no");
+               return snprintf(buff, len, "\"no\"");
        else
                return 0;
 }
--


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]