summaryrefslogtreecommitdiffstats
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:13 +0100
commit3f2df4e92a8b68760e8e4f3c481cce88bd0bd082 (patch)
tree65f8b0c854f6b9a0ef4f7938109afadaf6813c35
parent80c2876fd7d8f4b8bb0caa3160b966147e6c8d46 (diff)
downloadbarebox-3f2df4e92a8b68760e8e4f3c481cce88bd0bd082.tar.gz
barebox-3f2df4e92a8b68760e8e4f3c481cce88bd0bd082.tar.xz
fs: Fix can_lseek_backward()
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)