files: initialize a variable before referencing it
The lack of initialization caused a nasty bug on some targets (such as ARMv7) which would make it so that ^S would just say "Cancelled". While x86 (both 64 and 32 bits) seems to initialize 'response' to zero or a positive number, ARM does not, and there is usually a negative value in its place, which triggers the 'if (response < 0)' check and, as a result, the code says "Cancelled". This fixes https://savannah.gnu.org/bugs/?56023. Reported-by: Devin Hussey <husseydevin@gmail.com> Bug existed since version 4.0, commit 0f9d60a3. Signed-off-by: Devin Hussey <husseydevin@gmail.com>
This commit is contained in:
parent
85804ec70d
commit
7ad232d714
@ -2101,7 +2101,7 @@ int do_writeout(bool exiting, bool withprompt)
|
||||
|
||||
while (TRUE) {
|
||||
const char *msg;
|
||||
int response, choice;
|
||||
int response = 0, choice = 0;
|
||||
functionptrtype func;
|
||||
#ifndef NANO_TINY
|
||||
const char *formatstr, *backupstr;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user