linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erik Schmauss <erik.schmauss@intel.com>
To: rjw@rjwysocki.net, linux-acpi@vger.kernel.org
Cc: Bob Moore <robert.moore@intel.com>,
	Erik Schmauss <erik.schmauss@intel.com>
Subject: [PATCH 5/9] ACPICA: iASL,acpi_dump: Improve y/n query
Date: Fri, 16 Aug 2019 14:43:24 -0700	[thread overview]
Message-ID: <20190816214328.3900-6-erik.schmauss@intel.com> (raw)
In-Reply-To: <20190816214328.3900-1-erik.schmauss@intel.com>

From: Bob Moore <robert.moore@intel.com>

 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>
---
 tools/power/acpi/tools/acpidump/apfiles.c | 10 ++++++++--
 1 file 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);
 }
 
 /******************************************************************************
-- 
2.17.2


  parent reply	other threads:[~2019-08-16 21:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-16 21:43 [PATCH 0/9] ACPICA 20190816 release Erik Schmauss
2019-08-16 21:43 ` [PATCH 1/9] ACPICA: Debugger: remove redundant assignment on obj_desc Erik Schmauss
2019-08-16 21:43 ` [PATCH 2/9] ACPICA: Increase total number of possible Owner IDs Erik Schmauss
2019-08-16 21:43 ` [PATCH 3/9] ACPICA: Macros: remove pointer math on a null pointer Erik Schmauss
2019-08-16 21:43 ` [PATCH 4/9] ACPICA: Fix issues with arg types within printf format strings Erik Schmauss
2019-08-16 21:43 ` Erik Schmauss [this message]
2019-08-16 21:43 ` [PATCH 6/9] ACPICA: Fully deploy ACPI_PRINTF_LIKE macro Macro was not being used across all "printf-like" functions. Also, cleanup all calls to such functions now that they are analyzed by the compiler (gcc). Both in 32-bit mode and 64-bit mode Erik Schmauss
2019-08-16 21:43 ` [PATCH 7/9] ACPICA: Differentiate Windows 8.1 from Windows 8 Erik Schmauss
2019-08-16 21:43 ` [PATCH 8/9] ACPICA: Add "Windows 2019" string to _OSI support Erik Schmauss
2019-08-16 21:43 ` [PATCH 9/9] ACPICA: Update version to 20190816 Erik Schmauss
2019-08-26  9:07 ` [PATCH 0/9] ACPICA 20190816 release Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190816214328.3900-6-erik.schmauss@intel.com \
    --to=erik.schmauss@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=robert.moore@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).