From 2d2ec6619b84fd70ceaa5f4a347c428ff24339ad Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sun, 18 Mar 2012 17:59:46 +0100 Subject: read_file: Make it work on tftp servers which do not pass size Some tftp servers (for example netkit-tftp) do not pass the filesize. Add a workaround for read_file which reads the file into a temporary file which then is copied to a buffer. Signed-off-by: Sascha Hauer --- fs/tftp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'fs/tftp.c') diff --git a/fs/tftp.c b/fs/tftp.c index f86a7d1b0f..50efe0d77c 100644 --- a/fs/tftp.c +++ b/fs/tftp.c @@ -598,7 +598,10 @@ static int tftp_stat(struct device_d *dev, const char *filename, struct stat *s) return PTR_ERR(priv); s->st_mode = S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO; - s->st_size = priv->filesize; + if (priv->filesize) + s->st_size = priv->filesize; + else + s->st_size = FILESIZE_MAX; tftp_do_close(priv); -- cgit v1.2.3