Hi!

I have written a filesystem based on MACFuse. This works fine, But
sometimes if I want to write a file to the mounted Volume I get no
correct data.
Filesize and attributes are correct, but the file contains only 0
bytes.
I tried to reproduce this problem but I can't. If i try to copy the
same file again it works.

My code:

###FileSystem.m###

- (int) writeFileAtPath: (NSString *) path
                   fileDelegate: (id) fileDelegate
                                 buffer: (const char *) buffer
                                   size: (size_t) size
                                 offset: (off_t) offset
                                  error: (NSError **) error
{
        MyFile *file = [self getFile: path];

        // write data to file
        return [file write:buffer size:size offset:offset];
}

#### MyFile.m ####

- (int) write: (const char *) buffer
         size: (size_t) size
           offset: (off_t) offset
{
        @synchronized(self)
        {
                @try
                {
                        NSData *data = [NSData dataWithBytes:buffer 
length:size];
// ------ at this point the data bytes are already 0
-------------------

                        [[self fileHandle] seekToFileOffset:offset];

                        [[self fileHandle] writeData: data];
                        return size;
                }
                @catch (NSException *exp)
                {
                        NSLog(@"Exception at writing");
                }
        }
        return -1;
}






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MacFUSE" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/macfuse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to