Hi Carl, >>>>> "Carl" == Carl Worth writes: Carl> [1 ] Carl> On Mon, 23 Nov 2009 08:21:50 +0200, Dirk-Jan C. Binnema wrote: >> -#define prompt(format, ...) \ >> - do { \ >> - printf (format, ##__VA_ARGS__); \ >> - fflush (stdout); \ >> - getline (&response, &response_size, stdin); \ >> - chomp_newline (response); \ >> +#define prompt(format, ...) \ >> + do { \ >> + int ignored; \ >> + printf (format, ##__VA_ARGS__); \ >> + fflush (stdout); \ >> + ignored = getline (&response, &response_size, stdin); \ >> + chomp_newline (response); \ >> } while (0) Carl> This patch is incorrect. Ignoring the return value of getline results in Carl> the program invoking undefined behavior by reading uninitialized Carl> memory. This is easily tested by, for example, typing Control-D to Carl> provide EOF to a prompt from "notmuch setup". Carl> How about just exiting in case of EOF as in the patch below? Sure, that's the better solution, but note that my patch did not introduce the undefined behavior -- it was there before. I was trying a minimal patch to silencing the warning. Note that prompt seems to leak a bit, even after the committed patch; attached are two more micro patches to fix this and another small leak. I try to do minimal changes, but the prompt business gets a bit unwieldy. The leaks are one-time at not critical, but anyway it's always good stay vigilant.