Patchwork [BUG:2598] CLI : Display possible options in proper format.

login
register
Submitter Gaurav
Date 2011-04-07 07:12:33
Message ID <1302160353-26791-1-git-send-email-gaurav@gluster.com>
Download mbox | patch
Permalink /patch/6725/
State Accepted
Delegated to: Amar Tumballi
Headers show

Comments

Gaurav - 2011-04-07 07:12:33
From: Gaurav <gaurav@gluster.com>


Signed-off-by: Gaurav <gaurav@gluster.com>
---
 libglusterfs/src/xlator.c       |   16 ++++++++++++----
 rpc/rpc-lib/src/rpc-transport.c |    8 ++++++--
 2 files changed, 18 insertions(+), 6 deletions(-)

Patch

diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index b186414..b64bf44 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -334,9 +334,13 @@  _volume_option_value_validate_attacherr (xlator_t *xl,
                          */
                         char given_array[4096] = {0,};
                         for (i = 0; (i < ZR_OPTION_MAX_ARRAY_SIZE) &&
-                                     opt->value[i]; i++) {
+                                     opt->value[i];) {
                                 strcat (given_array, opt->value[i]);
-                                strcat (given_array, ", ");
+                                if(((++i) < ZR_OPTION_MAX_ARRAY_SIZE) &&
+                                   (opt->value[i]))
+				        strcat (given_array, ", ");
+                                else
+                                        strcat (given_array, ".");
                         }
 
                         gf_log (xl->name, GF_LOG_ERROR,
@@ -819,9 +823,13 @@  _volume_option_value_validate (xlator_t *xl,
 			 */
 			char given_array[4096] = {0,};
 			for (i = 0; (i < ZR_OPTION_MAX_ARRAY_SIZE) &&
-				     opt->value[i]; i++) {
+				     opt->value[i];) {
 				strcat (given_array, opt->value[i]);
-				strcat (given_array, ", ");
+                                if(((++i) < ZR_OPTION_MAX_ARRAY_SIZE) &&
+                                   (opt->value[i]))
+				        strcat (given_array, ", ");
+                                else
+                                        strcat (given_array, ".");
 			}
 
 			gf_log (xl->name, GF_LOG_ERROR,
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c
index 8701147..8d7940e 100644
--- a/rpc/rpc-lib/src/rpc-transport.c
+++ b/rpc/rpc-lib/src/rpc-transport.c
@@ -189,9 +189,13 @@  __volume_option_value_validate (char *name,
 			 */
 			char given_array[4096] = {0,};
 			for (i = 0; (i < ZR_OPTION_MAX_ARRAY_SIZE) &&
-				     opt->value[i]; i++) {
+				     opt->value[i];) {
 				strcat (given_array, opt->value[i]);
-				strcat (given_array, ", ");
+                                if(((++i) < ZR_OPTION_MAX_ARRAY_SIZE) &&
+                                   (opt->value[i]))
+				        strcat (given_array, ", ");
+                                else
+                                        strcat (given_array, ".");
 			}
 
 			gf_log (name, GF_LOG_ERROR,