sizeof(int) != sizeof(size_t) for LP64, leading to hilarity^Wcrashes. --- toys/pending/modprobe.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
From 06b501923077c983697b21081f1b72a958635636 Mon Sep 17 00:00:00 2001 From: Elliott Hughes <e...@google.com> Date: Wed, 28 Dec 2016 18:26:55 -0800 Subject: [PATCH] Stop lying to the compiler in modprobe's read_line.
sizeof(int) != sizeof(size_t) for LP64, leading to hilarity^Wcrashes. --- toys/pending/modprobe.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/toys/pending/modprobe.c b/toys/pending/modprobe.c index ebf17a0..7c93a5c 100644 --- a/toys/pending/modprobe.c +++ b/toys/pending/modprobe.c @@ -170,12 +170,13 @@ static struct module_s *get_mod(char *mod, uint8_t add) static int read_line(FILE *fl, char **li) { char *nxtline = NULL, *line; - int len, nxtlen, linelen, nxtlinelen; + ssize_t len, nxtlen; + size_t linelen, nxtlinelen; while (1) { line = NULL; linelen = nxtlinelen = 0; - len = getline(&line, (size_t*)&linelen, fl); + len = getline(&line, &linelen, fl); if (len <= 0) { free(line); return len; @@ -192,7 +193,7 @@ static int read_line(FILE *fl, char **li) } else if (line[len - 1] != '\\') break; len--; - nxtlen = getline(&nxtline, (size_t*)&nxtlinelen, fl); + nxtlen = getline(&nxtline, &nxtlinelen, fl); if (nxtlen <= 0) break; if (linelen < len + nxtlen + 1) { linelen = len + nxtlen + 1; -- 2.8.0.rc3.226.g39d4020
_______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net