From e120bb936ef014673007ae4ff7f5780aff9d160b Mon Sep 17 00:00:00 2001 From: David Levine Date: Sun, 24 Apr 2016 22:09:39 -0400 Subject: [PATCH] Check for empty code. --- uip/mhlogin.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/uip/mhlogin.c b/uip/mhlogin.c index 88912b5c..6ce414f2 100644 --- a/uip/mhlogin.c +++ b/uip/mhlogin.c @@ -101,9 +101,10 @@ do_login(const char *svc, const char *user, const char *browser, int snoop) fflush(stdout); code = geta(); - while ((cred = mh_oauth_authorize(code, ctx)) == NULL - && mh_oauth_get_err_code(ctx) == MH_OAUTH_BAD_GRANT) { - printf("Code rejected; try again? "); + while (strlen(code) == 0 || + ((cred = mh_oauth_authorize(code, ctx)) == NULL + && mh_oauth_get_err_code(ctx) == MH_OAUTH_BAD_GRANT)) { + printf(strlen(code) == 0 ? "Empty code; try again? " : "Code rejected; try again? "); fflush(stdout); code = geta(); } -- 2.56.0