monitor: avoid use of global *cur_mon in file_completion()
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
cd5c6bba1b
commit
cb8f68b104
@ -4035,7 +4035,7 @@ static void cmd_completion(Monitor *mon, const char *name, const char *list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void file_completion(const char *input)
|
static void file_completion(Monitor *mon, const char *input)
|
||||||
{
|
{
|
||||||
DIR *ffs;
|
DIR *ffs;
|
||||||
struct dirent *d;
|
struct dirent *d;
|
||||||
@ -4058,7 +4058,7 @@ static void file_completion(const char *input)
|
|||||||
pstrcpy(file_prefix, sizeof(file_prefix), p + 1);
|
pstrcpy(file_prefix, sizeof(file_prefix), p + 1);
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_COMPLETION
|
#ifdef DEBUG_COMPLETION
|
||||||
monitor_printf(cur_mon, "input='%s' path='%s' prefix='%s'\n",
|
monitor_printf(mon, "input='%s' path='%s' prefix='%s'\n",
|
||||||
input, path, file_prefix);
|
input, path, file_prefix);
|
||||||
#endif
|
#endif
|
||||||
ffs = opendir(path);
|
ffs = opendir(path);
|
||||||
@ -4085,7 +4085,7 @@ static void file_completion(const char *input)
|
|||||||
if (stat(file, &sb) == 0 && S_ISDIR(sb.st_mode)) {
|
if (stat(file, &sb) == 0 && S_ISDIR(sb.st_mode)) {
|
||||||
pstrcat(file, sizeof(file), "/");
|
pstrcat(file, sizeof(file), "/");
|
||||||
}
|
}
|
||||||
readline_add_completion(cur_mon->rs, file);
|
readline_add_completion(mon->rs, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(ffs);
|
closedir(ffs);
|
||||||
@ -4196,7 +4196,7 @@ static void monitor_find_completion(const char *cmdline)
|
|||||||
case 'F':
|
case 'F':
|
||||||
/* file completion */
|
/* file completion */
|
||||||
readline_set_completion_index(cur_mon->rs, strlen(str));
|
readline_set_completion_index(cur_mon->rs, strlen(str));
|
||||||
file_completion(str);
|
file_completion(mon, str);
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
/* block device name completion */
|
/* block device name completion */
|
||||||
|
Loading…
Reference in New Issue
Block a user