From 4281a1a7f2d24cfcf0997122cc75c216a17f3e5b Mon Sep 17 00:00:00 2001 From: Laszlo Papp Date: Sat, 17 Oct 2009 23:12:19 +0200 Subject: Size handling was changed in fgets() functions Pacman's fgets function in the API used hardcoded numbers to identify the size. This is not good practice, so replace them with sizeof handling. Signed-off-by: Laszlo Papp Signed-off-by: Dan McGee --- src/pacman/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pacman/util.c b/src/pacman/util.c index 0e5e7f5c..1143befd 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -580,6 +580,7 @@ void display_optdepends(pmpkg_t *pkg) static int question(short preset, char *fmt, va_list args) { char response[32]; + int sresponse = sizeof(response)-1; FILE *stream; if(config->noconfirm) { @@ -602,7 +603,7 @@ static int question(short preset, char *fmt, va_list args) return(preset); } - if(fgets(response, 32, stdin)) { + if(fgets(response, sresponse, stdin)) { strtrim(response); if(strlen(response) == 0) { return(preset); -- cgit v1.2.3-2-g168b