diff options
author | Joe Thornber <ejt@redhat.com> | 2018-04-20 10:43:50 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2018-04-20 11:03:58 -0500 |
commit | 00f1b208a1bf44665ec97a791355b1fcf525a3a7 (patch) | |
tree | 6414eaef877cc4e63957729c8d8289debb8af743 /tools/command.c | |
parent | d51429254f4e9b17083af0c554aa7045e5ec08bb (diff) | |
download | lvm2-00f1b208a1bf44665ec97a791355b1fcf525a3a7.tar.gz |
[io paths] Unpick agk's aio stuff
Diffstat (limited to 'tools/command.c')
-rw-r--r-- | tools/command.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/command.c b/tools/command.c index a40b327b4..8944399b3 100644 --- a/tools/command.c +++ b/tools/command.c @@ -1357,11 +1357,13 @@ static void _create_opt_names_alpha(void) qsort(opt_names_alpha, ARG_COUNT, sizeof(long), _long_name_compare); } -static int _copy_line(char *line, int max_line, int *position, int *len) +static int _copy_line(char *line, int max_line, int *position) { int p = *position; int i = 0; + memset(line, 0, max_line); + while (1) { line[i] = _command_input[p]; i++; @@ -1375,9 +1377,7 @@ static int _copy_line(char *line, int max_line, int *position, int *len) if (i == (max_line - 1)) break; } - line[i] = '\0'; *position = p; - *len = i + 1; return 1; } @@ -1395,7 +1395,6 @@ int define_commands(struct cmd_context *cmdtool, const char *run_name) int prev_was_oo = 0; int prev_was_op = 0; int copy_pos = 0; - int copy_len = 0; int skip = 0; int i; @@ -1406,14 +1405,14 @@ int define_commands(struct cmd_context *cmdtool, const char *run_name) /* Process each line of command-lines-input.h (from command-lines.in) */ - while (_copy_line(line, MAX_LINE, ©_pos, ©_len)) { + while (_copy_line(line, MAX_LINE, ©_pos)) { if (line[0] == '\n') break; if ((n = strchr(line, '\n'))) *n = '\0'; - memcpy(line_orig, line, copy_len); + memcpy(line_orig, line, sizeof(line)); _split_line(line, &line_argc, line_argv, ' '); if (!line_argc) |