diff options
Diffstat (limited to 'lib/sqfs/src/io/unix.c')
-rw-r--r-- | lib/sqfs/src/io/unix.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/sqfs/src/io/unix.c b/lib/sqfs/src/io/unix.c index 2e97394..cac8e55 100644 --- a/lib/sqfs/src/io/unix.c +++ b/lib/sqfs/src/io/unix.c @@ -10,6 +10,7 @@ #include "sqfs/io.h" #include "sqfs/error.h" +#include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> @@ -85,3 +86,16 @@ int sqfs_native_file_seek(sqfs_file_handle_t fd, return 0; } + +int sqfs_native_file_get_size(sqfs_file_handle_t hnd, sqfs_u64 *out) +{ + struct stat sb; + + if (fstat(hnd, &sb)) { + *out = 0; + return SQFS_ERROR_IO; + } + + *out = sb.st_size; + return 0; +} |