diff --git a/bcache.c b/bcache.c index 444643dc..5d1162f1 100644 --- a/bcache.c +++ b/bcache.c @@ -934,39 +934,19 @@ int list_cachesets(char *cset_dir) return 0; } -char *parse_array_to_list(char *const *args) -{ - int i, len = 0; - char *space = " "; - for(i=0; args[i] != NULL; i++) { - len+=strlen(args[i]) + 1; - } - - char *arg_list = (char*)malloc(sizeof(char)*len); - strcpy(arg_list, args[0]); - strcat(arg_list, space); - - for(i=1; args[i] != NULL; i++) { - strcat(arg_list, args[i]); - strcat(arg_list, space); - } - - return arg_list; -} - int register_bcache(char *devs) { int ret, bcachefd; bcachefd = open("/dev/bcache", O_RDWR); if (bcachefd < 0) { - perror("Can't open bcache device"); + perror("Can't open bcache device\n"); exit(EXIT_FAILURE); } ret = ioctl(bcachefd, BCH_IOCTL_REGISTER, devs); if (ret < 0) { - fprintf(stderr, "ioctl register error: %s", strerror(ret)); + fprintf(stderr, "ioctl register error: %s\n", strerror(ret)); exit(EXIT_FAILURE); } return 0; diff --git a/bcacheadm.c b/bcacheadm.c index e0cccb89..64ebb6b2 100644 --- a/bcacheadm.c +++ b/bcacheadm.c @@ -345,13 +345,7 @@ int probe_bcache (NihCommand *command, char *const *args) int bcache_register (NihCommand *command, char *const *args) { - int ret; - char *arg_list = parse_array_to_list(args); - - if(arg_list) { - ret = register_bcache(arg_list); - free(arg_list); - } + int ret = register_bcache(args); return ret; }