X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Futils%2Fmount_utils.c;h=31cec4abca8fa6c956293edc5be0ccfe59994c6a;hp=1fca4c708a563f226e098f742b38f1debbdb68f0;hb=11317196203c26f8c9e4d2a8261859b1c7a76c9d;hpb=1f55f2a9071d5e7db4042b959723086dee1c379a diff --git a/lustre/utils/mount_utils.c b/lustre/utils/mount_utils.c index 1fca4c7..31cec4a 100644 --- a/lustre/utils/mount_utils.c +++ b/lustre/utils/mount_utils.c @@ -102,31 +102,19 @@ int run_command(char *cmd, int cmdsz) int add_param(char *buf, char *key, char *val) { - char *sub_val = NULL; - int buflen = strlen(buf); - int end = sizeof(((struct lustre_disk_data *)0)->ldd_params); - int start = 0; - int keylen = 0; + int end = sizeof(((struct lustre_disk_data *)0)->ldd_params); + int start = strlen(buf); + int keylen = 0; - if (key != NULL) + if (key) keylen = strlen(key); - - start = buflen; - while ((sub_val = strsep(&val, ",")) != NULL) { - if (*sub_val == 0) - continue; - - if (start + 1 + keylen + strlen(sub_val) >= end) { - fprintf(stderr, "%s: params are too long-\n%s %s%s\n", - progname, buf, key != NULL ? key : "", sub_val); - buf[buflen] = '\0'; - return 1; - } - - sprintf(buf + start, " %s%s", key != NULL ? key : "", sub_val); - start = strlen(buf); + if (start + 1 + keylen + strlen(val) >= end) { + fprintf(stderr, "%s: params are too long-\n%s %s%s\n", + progname, buf, key ? key : "", val); + return 1; } + sprintf(buf + start, " %s%s", key ? key : "", val); return 0; }