From 8e98bdaa6fe2b9055ef8ef5cf48d31a082cd5c5b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 15 Oct 2017 21:21:19 -0700 Subject: [PATCH] Fixed bug 3883 - SDL_assert / SDL_PromptAssertion in TTY mode does not accept options ("abriA") shoerbaffen fgets can read a newline and SDL_strcmp will never return zero. --- src/SDL_assert.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SDL_assert.c b/src/SDL_assert.c index 47309eb7ce030..1eca9232d25e3 100644 --- a/src/SDL_assert.c +++ b/src/SDL_assert.c @@ -278,19 +278,19 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) break; } - if (SDL_strcmp(buf, "a") == 0) { + if (SDL_strncmp(buf, "a", 1) == 0) { state = SDL_ASSERTION_ABORT; break; - } else if (SDL_strcmp(buf, "b") == 0) { + } else if (SDL_strncmp(buf, "b", 1) == 0) { state = SDL_ASSERTION_BREAK; break; - } else if (SDL_strcmp(buf, "r") == 0) { + } else if (SDL_strncmp(buf, "r", 1) == 0) { state = SDL_ASSERTION_RETRY; break; - } else if (SDL_strcmp(buf, "i") == 0) { + } else if (SDL_strncmp(buf, "i", 1) == 0) { state = SDL_ASSERTION_IGNORE; break; - } else if (SDL_strcmp(buf, "A") == 0) { + } else if (SDL_strncmp(buf, "A", 1) == 0) { state = SDL_ASSERTION_ALWAYS_IGNORE; break; }