summaryrefslogtreecommitdiffstats
path: root/src/ifuse.c
diff options
context:
space:
mode:
authorGravatar Zoltan Balaton2009-01-13 22:21:03 -0800
committerGravatar Matt Colyer2009-01-13 22:21:03 -0800
commit54311c89363d1d5ed375370635a17d96f141393c (patch)
treef52c11e314dfeba79f6754b014a1abe7f1ee9258 /src/ifuse.c
parentb0412bfdaa33c9876893e529cec5b9f3ea176022 (diff)
downloadifuse-54311c89363d1d5ed375370635a17d96f141393c.tar.gz
ifuse-54311c89363d1d5ed375370635a17d96f141393c.tar.bz2
Correctly handle file modes.
Diffstat (limited to 'src/ifuse.c')
-rw-r--r--src/ifuse.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ifuse.c b/src/ifuse.c
index 1db04ad..670a458 100644
--- a/src/ifuse.c
+++ b/src/ifuse.c
@@ -82,7 +82,7 @@ static int ifuse_create(const char *path, mode_t mode, struct fuse_file_info *fi
uint32 *argh_filehandle = (uint32 *) malloc(sizeof(uint32));
iphone_afc_client_t afc = fuse_get_context()->private_data;
- iphone_afc_open_file(afc, path, IPHONE_AFC_FILE_WRITE, &file);
+ iphone_afc_open_file(afc, path, IPHONE_AFC_FILE_WRITE | IPHONE_AFC_FILE_CREAT, &file);
*argh_filehandle = iphone_afc_get_file_handle(file);
fi->fh = *argh_filehandle;
g_hash_table_insert(file_handles, argh_filehandle, file);
@@ -96,8 +96,10 @@ static int ifuse_open(const char *path, struct fuse_file_info *fi)
iphone_afc_client_t afc = fuse_get_context()->private_data;
uint32_t mode = 0;
- if ((fi->flags & 3) == O_RDWR || (fi->flags & 3) == O_WRONLY) {
- mode = IPHONE_AFC_FILE_READ;
+ if ((fi->flags & 3) == O_RDWR) {
+ mode = IPHONE_AFC_FILE_RW;
+ } else if ((fi->flags & 3) == O_WRONLY) {
+ mode = IPHONE_AFC_FILE_WRITE;
} else if ((fi->flags & 3) == O_RDONLY) {
mode = IPHONE_AFC_FILE_READ;
} else {