summaryrefslogtreecommitdiffstats
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
parentb0412bfdaa33c9876893e529cec5b9f3ea176022 (diff)
downloadifuse-54311c89363d1d5ed375370635a17d96f141393c.tar.gz
ifuse-54311c89363d1d5ed375370635a17d96f141393c.tar.bz2
Correctly handle file modes.
-rw-r--r--AUTHORS1
-rw-r--r--src/ifuse.c8
2 files changed, 6 insertions, 3 deletions
diff --git a/AUTHORS b/AUTHORS
index 39ea345..0d7c540 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -4,3 +4,4 @@ Matt Colyer
Martin Aumueller
Christophe Fergeau
Paul Sladen
+Zoltan Balaton
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 {