All,
First of all, I apologize if this topic has been discussed already,
but I did my best to try to find references to similar issues, with no
luck.

The problem: I have a test application that behaves differently when I
run it on my Mac vs. Linux. The test application simply open a file
with attributes O_WRONLY | O_CREAT, then write a string "Hello World',
then call again another write() this time with "Merry Christmas", then
finally close the file.

On Mac I see two callbacks to write (correct here...): the first one
for a buffer containing "Hello World\0", the second time, for a buffer
containing "Hello World\0Merry Christmas\0" (this doesn't seem to be
right...).

When I run the same test on Linux the write() calls are correct: the
first one for the buffer "Hello World\0", the second one for the
buffer "Merry Christmas\0".

Is this something related to OSX? Why isn't working on Mac?
Any idea?

Notes:
I have tested this behavior with the 'fusexmp_fh' example that comes
with the original Fuse distribution. The fusexmp_fh is a simple
wrapper to access the filesystem from your fuse mounted directory.
The test application source code is here:
------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <string.h>
#include <fcntl.h>

const char * const string1 = "Hello world";
const char * const string2 = "Merry Christmas";
int main() {
        int f;
        const size_t string1Len = strlen(string1) + 1;
        const size_t string2Len = strlen(string2) + 1;
        printf("Press ENTER to open...\n");
        getchar();
        f = open("/mnt/fuse/tmp/foo", O_WRONLY | O_CREAT);
        if (f == -1) {
            perror("Cannot open data writer");
            return -1;
        }
        printf("Press ENTER to write the first string...\n"); getchar
();
        if (write(f, string1, string1Len) != string1Len) {
            perror("write error (1)");
            return -1;
        }
        printf("Press ENTER to write the second string...\n"); getchar
();
        if (write(f, string2, string2Len) != string2Len) {
            perror("write error (2)");
            return -1;
        }
        printf("Press ENTER to close\n"); getchar();
        close(f);
        return 0;
}
---------------------------------------------------------------

Thanks in advance!
Fabrizio
--~--~---------~--~----~------------~-------~--~----~
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