summaryrefslogtreecommitdiffstats
path: root/fs/uimagefs.c
diff options
context:
space:
mode:
authorMichael Grzeschik <m.grzeschik@pengutronix.de>2017-11-08 19:07:47 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-11-10 08:01:18 +0100
commit7c3f8d3663cbee7e406bf949a263ce82f6b34ae8 (patch)
tree22cc0d8430ddf99d4e76a4ad9678d96813b6e377 /fs/uimagefs.c
parented5d71ab06bf45e585f9d03049f4730109979aff (diff)
downloadbarebox-7c3f8d3663cbee7e406bf949a263ce82f6b34ae8.tar.gz
barebox-7c3f8d3663cbee7e406bf949a263ce82f6b34ae8.tar.xz
uimage: fix: add can_lseek_backward and use in uimage_open
Since commit ce0cc7fe we support forward seek on tftpfs. This feature breaks the condition to check rather we open an uimage over tftp. Since backward seeking is the problem here, we add the function can_lseek_backward and check for it instead of the simple lseek. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs/uimagefs.c')
-rw-r--r--fs/uimagefs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/uimagefs.c b/fs/uimagefs.c
index 13c1fbac05..c0c5750c2c 100644
--- a/fs/uimagefs.c
+++ b/fs/uimagefs.c
@@ -374,9 +374,9 @@ again:
/*
* Hack around tftp fs. We need lseek for uImage support, but
* this cannot be implemented in tftp fs, so we detect this
- * by doing a test lseek and copy the file to ram if it fails
+ * and copy the file to ram if it fails
*/
- if (IS_BUILTIN(CONFIG_FS_TFTP) && lseek(fd, 0, SEEK_SET)) {
+ if (IS_BUILTIN(CONFIG_FS_TFTP) && !can_lseek_backward(fd)) {
close(fd);
ret = copy_file(priv->filename, priv->tmp, 0);
if (ret)