[dm-devel] [PATCH] multipathd: fix issue in 'map $map getprstatus' reply
peng.liang5 at zte.com.cn
peng.liang5 at zte.com.cn
Wed Aug 3 07:09:15 UTC 2016
From: peng liang <peng.liang5 at zte.com.cn>
-add missing newline to 'map|multipath $map getprstatus' reply
-use asprintf instead of sprintf
Signed-off-by: peng liang <peng.liang5 at zte.com.cn>
---
multipathd/cli_handlers.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 8ff4362..cec40eb 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -1,6 +1,9 @@
/*
* Copyright (c) 2005 Christophe Varoqui
*/
+#define _GNU_SOURCE
+
+#include <stdio.h>
#include "checkers.h"
#include "memory.h"
#include "vector.h"
@@ -1285,14 +1288,8 @@ cli_getprstatus (void * v, char ** reply, int * len, void * data)
condlog(3, "%s: prflag = %u", param, (unsigned int)mpp->prflag);
- *reply =(char *)malloc(2);
- *len = 2;
- memset(*reply,0,2);
-
-
- sprintf(*reply,"%d",mpp->prflag);
- (*reply)[1]='\0';
-
+ *len = 3;
+ asprintf(reply, "%d\n", mpp->prflag);
condlog(3, "%s: reply = %s", param, *reply);
--
2.8.1.windows.1
More information about the dm-devel
mailing list