diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/common.h | 7 | 
1 files changed, 2 insertions, 5 deletions
| diff --git a/include/common.h b/include/common.h index 2ce5d22..ece2287 100644 --- a/include/common.h +++ b/include/common.h @@ -141,15 +141,14 @@ extern "C" {   */  static inline bool prompt(const char *msg, bool def)  { -	char *line = NULL; -	size_t len;  	bool ret = def; +	char line[64];  	do {  		normsg_cont("%s (%c/%c) ", msg, def ? 'Y' : 'y', def ? 'n' : 'N');  		fflush(stdout); -		while (getline(&line, &len, stdin) == -1) { +		if (fgets(line, sizeof(line), stdin) == NULL) {  			printf("failed to read prompt; assuming '%s'\n",  				def ? "yes" : "no");  			break; @@ -169,8 +168,6 @@ static inline bool prompt(const char *msg, bool def)  		break;  	} while (1); -	free(line); -  	return ret;  } | 
