summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2017-11-15 14:27:53 -0800
committerSascha Hauer <s.hauer@pengutronix.de>2017-11-17 09:56:44 +0100
commitab027dcfb4f2b72aef900772d5576aaccb2689b2 (patch)
tree264c1edbf6c7e3adeb9eb3391bc26d05dd9eb4bf
parent5f5decec00df364859fd375dde8c0e2c148447d1 (diff)
downloadbarebox-stable/v2017.11.tar.gz
fs: Fix can_lseek_backward()stable/v2017.11
To quote corresponding man page: "... Upon successful completion, lseek() returns the resulting offset location as measured in bytes from the beginning of the file." Which for lseek(fd, 0, SEEK_SET) would be 0, so returning 'ret' as final step of the function would mean it'd never return anything but 0 as well. Change the code to explicitly return '1' to fix the problem. Fixes: 7c3f8d366 ("uimage: fix: add can_lseek_backward and use in uimage_open") Cc: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--include/fs.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/fs.h b/include/fs.h
index f8a3b8bda4..5c5fff8701 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -117,7 +117,7 @@ static inline int can_lseek_backward(int fd)
if (ret < 0)
return 0;
- return ret;
+ return 1;
}
#define drv_to_fs_driver(d) container_of(d, struct fs_driver_d, drv)