On Fri, Aug 19, 2011 at 4:10 PM, Pavel Ivanov <paiva...@gmail.com> wrote:
> No, it won't cause corruption. Because SQLite uses pwrite or its > alternative with calls to lseek and write. So after interruption it > will start writing at the same position it wrote previous time > rewriting part of what it has already written with the same data. i see. Just poking around a bit... pwrite has different semantics than write: pwrite() writes up to count bytes from the buffer starting at buf to the file descriptor fd at offset offset. The file offset is not changed. whereas write(2) says: "... and the file offset is incremented by the number of bytes actually written" osWrite is defined as write(2) and osPwrite is defined as pwrite(). There appears to be one block which uses osWrite instead of osPwrite but still relies on the pwrite semantics: if( statbuf.st_size==0 && (pFile->fsFlags & SQLITE_FSFLAGS_IS_MSDOS)!=0 ){ do{ rc = osWrite(fd, "S", 1); }while( rc<0 && errno==EINTR ); if( rc!=1 ){ line 1159 in my copy. In that particular case, with a length of 1, they are "probably" semantically equivalent, though. -- ----- stephan beal http://wanderinghorse.net/home/stephan/ _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users