From d5e2c6a3146c20354ab11f1dae48ab755996fa96 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 8 Sep 2023 18:49:54 +0200 Subject: libsqfs: bring sqfs_file_t in line with stream API Rename the open function to sqfs_file_open, use an argument for the return pointer and pass back and error number on failure. Also add an inermediate function to open an sqfs_file_t using a handle, similar to the stream API. The get_file_size function is moved to the native wrappers and some of the implementation is cleaned up a little. Signed-off-by: David Oberhollenzer --- lib/common/src/writer/init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/common/src/writer') diff --git a/lib/common/src/writer/init.c b/lib/common/src/writer/init.c index 60d7a12..bf1d2ca 100644 --- a/lib/common/src/writer/init.c +++ b/lib/common/src/writer/init.c @@ -57,9 +57,9 @@ int sqfs_writer_init(sqfs_writer_t *sqfs, const sqfs_writer_cfg_t *wrcfg) return -1; } - sqfs->outfile = sqfs_open_file(wrcfg->filename, wrcfg->outmode); - if (sqfs->outfile == NULL) { - perror(wrcfg->filename); + ret = sqfs_file_open(&sqfs->outfile, wrcfg->filename, wrcfg->outmode); + if (ret) { + sqfs_perror(wrcfg->filename, "open", ret); return -1; } -- cgit v1.2.3