diff options
author | David Champion <dgc@c13.us> | 2019-11-13 00:27:28 +0000 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2019-11-12 19:18:00 -0800 |
commit | 20c7b0d8ea649b9e039214f4abf144c3abc27ec9 (patch) | |
tree | 9e31a106e270a419105e801afaa36ecd18269608 | |
parent | f098ac2dce4eefda835ec479cc5b1bf92fd0db9b (diff) |
Fix __attribute__((warn_unused_result)) issue in query.c
Changing to mutt_read_line() avoids -Wunused-result warning while
reading the ignored line in query protocol response.
-rw-r--r-- | query.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -98,7 +98,8 @@ static QUERY *run_query (char *s, int quiet) char *buf = NULL; size_t buflen; int dummy = 0; - char msg[STRING]; + char *msg = NULL; + size_t msglen; char *p; pid_t thepid; @@ -115,9 +116,10 @@ static QUERY *run_query (char *s, int quiet) if (!quiet) mutt_message _("Waiting for response..."); - fgets (msg, sizeof (msg), fp); - if ((p = strrchr (msg, '\n'))) - *p = '\0'; + + /* The query protocol first reads one NL-terminated line. If an error + * occurs, this is assumed to be an error message. Otherwise it's ignored. */ + msg = mutt_read_line (msg, &msglen, fp, &dummy, 0); while ((buf = mutt_read_line (buf, &buflen, fp, &dummy, 0)) != NULL) { if ((p = strtok(buf, "\t\n"))) @@ -156,6 +158,7 @@ static QUERY *run_query (char *s, int quiet) if (!quiet) mutt_message ("%s", msg); } + FREE (&msg); return first; } |