summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2019-08-17 00:43:24 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-08-21 01:00:36 +0300
commit09d2c01ba9e73254e9e6c4fda59d5cf6bd3c89ed (patch)
tree09b76efbd12e6ceae1d5aa3fe574827af8ff799d
parent231ec06e793891071e491e574fe351835aeb9c5c (diff)
downloadlinux-09d2c01ba9e73254e9e6c4fda59d5cf6bd3c89ed.tar.xz
ACPICA: iASL,acpi_dump: Improve y/n query
The y/n query is used for file overwrite. Use fgetc, check for standalone newline. ACPICA commit f9eb60ead76e5b2b6e578b553f592452ccfca47a Link: https://github.com/acpica/acpica/commit/f9eb60ea Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Erik Schmauss <erik.schmauss@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--tools/power/acpi/tools/acpidump/apfiles.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/power/acpi/tools/acpidump/apfiles.c b/tools/power/acpi/tools/acpidump/apfiles.c
index a42cfcaa3293..16d919bd133b 100644
--- a/tools/power/acpi/tools/acpidump/apfiles.c
+++ b/tools/power/acpi/tools/acpidump/apfiles.c
@@ -29,18 +29,24 @@ static int ap_is_existing_file(char *pathname)
{
#if !defined(_GNU_EFI) && !defined(_EDK2_EFI)
struct stat stat_info;
+ int in_char;
if (!stat(pathname, &stat_info)) {
fprintf(stderr,
"Target path already exists, overwrite? [y|n] ");
- if (getchar() != 'y') {
+ in_char = fgetc(stdin);
+ if (in_char == '\n') {
+ in_char = fgetc(stdin);
+ }
+
+ if (in_char != 'y' && in_char != 'Y') {
return (-1);
}
}
#endif
- return 0;
+ return (0);
}
/******************************************************************************