Please find attached.
P.S. I have added the fflush () call before the fsync () call.
Regards
~Sameer
2010/9/15 Jean-Pierre André <jean-pierre.an...@wanadoo.fr>:
> Hi,
>
> JD wrote:
>>
>>
>> On 09/15/2010 03:21 AM, ntfs-3g-devel-requ...@lists.sourceforge.net wrote:
>>
>>> Re: fsync() does not write out the file to the disk (Sameer Naik)
>>>
>> My current installation of ntfs-3g-2010.8.8-2.fc13.i686 does not exhibit
>> this behaviour, albeit, I am not using my own C program to
>> copy a file to an ntfs partition. I am just using /bin/cp.
>> I have my windows xp partition mounted as /sda1.
>>
>
> Maybe because cp does a fsync() (I have not checked).
>
>> $ ls -l /tmp/nss-deplists.txt
>> -rw-r--r-- 1 jd jd 72247 Sep 15 08:10 /tmp/nss-deplists.txt
>> $ cp /tmp/nss\-deplists.txt /sda1/Tmp; sudo umount /sda1; sudo mount
>> /sda1; ls -l /sda1/Tmp/nss*
>> -rwxrwxrwx 1 jd jd 72247 Sep 15 08:32 /sda1/Tmp/nss-deplists.txt
>>
>> Where can I find Sameer's test program to see the problem for myself?
>>
>
> It was attached to his original post on this list
> (which I received on Aug 24 1:03pm - must mean
> 11:03 am UTC).
> Just add a fflush(outfile) before the fsync().
>
> If you cannot get it, ask again.
>
> Regards
>
> Jean-Pierre
>
>
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> ntfs-3g-devel mailing list
> ntfs-3g-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel
>
#include <stdio.h>
#define MAX_BUFFER 512
int main (int argc, char *argv[])
{
FILE *infile;
FILE *outfile;
char buffer[MAX_BUFFER];
int len;
int eof = 0;
int fd;
if (argc < 3) {
printf ("Usage: %s src dest\n", argv[0]);
return 1;
}
infile = fopen (argv[1], "r");
if (infile == NULL) {
printf ("error: could not open %s for reading\n", argv[1]);
return 1;
}
outfile = fopen (argv[2], "w");
if (outfile == NULL) {
printf ("error: could not open %s for writing\n", argv[2]);
return 1;
}
while (eof == 0) {
len = fread (buffer, 1, MAX_BUFFER, infile);
if (len < MAX_BUFFER) {
eof = feof (infile);
}
if (len)
fwrite (buffer, 1, len, outfile);
}
fclose (infile);
printf ("sync'ing %s...", argv[2]);
fflush (outfile);
fd = fileno (outfile);
fsync (fd);
printf ("done\n");
fclose (outfile);
return 0;
}
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
ntfs-3g-devel mailing list
ntfs-3g-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel