aboutsummaryrefslogtreecommitdiff
path: root/lib/io/src/unix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/io/src/unix')
-rw-r--r--lib/io/src/unix/istream.c5
-rw-r--r--lib/io/src/unix/ostream.c9
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/io/src/unix/istream.c b/lib/io/src/unix/istream.c
index 39d570f..ca9a183 100644
--- a/lib/io/src/unix/istream.c
+++ b/lib/io/src/unix/istream.c
@@ -144,11 +144,10 @@ fail_free:
sqfs_istream_t *istream_open_file(const char *path)
{
+ sqfs_file_handle_t fd;
sqfs_istream_t *out;
- int fd;
- fd = open(path, O_RDONLY);
- if (fd < 0) {
+ if (sqfs_open_native_file(&fd, path, SQFS_FILE_OPEN_READ_ONLY)) {
perror(path);
return NULL;
}
diff --git a/lib/io/src/unix/ostream.c b/lib/io/src/unix/ostream.c
index 0e95167..52a566a 100644
--- a/lib/io/src/unix/ostream.c
+++ b/lib/io/src/unix/ostream.c
@@ -177,13 +177,12 @@ fail_free:
sqfs_ostream_t *ostream_open_file(const char *path, int flags)
{
+ sqfs_file_handle_t fd;
sqfs_ostream_t *out;
- int fd;
- if (flags & SQFS_FILE_OPEN_OVERWRITE) {
- fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
- } else {
- fd = open(path, O_WRONLY | O_CREAT | O_EXCL, 0644);
+ if (sqfs_open_native_file(&fd, path, flags)) {
+ perror(path);
+ return NULL;
}
out = ostream_open_handle(path, fd, flags);