[PATCH] uimage: fix: broken uimage_open on tftp since forward lseek works

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since commit ce0cc7fe we support forward seek on tftpfs. This feature
breaks the condition to check rather we open an uimage over tftp. Since
random seeking is the problem here, we check in both directions.

Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
---
 common/uimage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/uimage.c b/common/uimage.c
index 28a25bba2d..b07c6ff279 100644
--- a/common/uimage.c
+++ b/common/uimage.c
@@ -113,7 +113,8 @@ again:
 	 * 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
 	 */
-	if (IS_BUILTIN(CONFIG_FS_TFTP) && lseek(fd, 0, SEEK_SET)) {
+	if (IS_BUILTIN(CONFIG_FS_TFTP) &&
+			(lseek(fd, 4, SEEK_SET) && lseek(fd, 0, SEEK_SET))) {
 		close(fd);
 		ret = copy_file(filename, uimage_tmp, 0);
 		if (ret)
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux