aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-12-28 18:26:55 -0800
committerRob Landley <rob@landley.net>2016-12-28 22:50:15 -0600
commit8ddfb71b17369bcd3bd247a76f0a2c4cf301016b (patch)
treed36231c8bbee48175b5d73f816fe862a6bdf2ed1 /toys
parent731a54b768d6b61fa5ef2e1bc39cee882c25bcce (diff)
downloadtoybox-8ddfb71b17369bcd3bd247a76f0a2c4cf301016b.tar.gz
Stop lying to the compiler in modprobe's read_line.
sizeof(int) != sizeof(size_t) for LP64, leading to hilarity^Wcrashes.
Diffstat (limited to 'toys')
-rw-r--r--toys/pending/modprobe.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/toys/pending/modprobe.c b/toys/pending/modprobe.c
index ebf17a0e..7c93a5cd 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;