Well some keystroke I hit apparently made the stupid browser send that before I finished editing it, but you get the idea....
Sigh, John On Tue, Oct 14, 2014 at 9:12 AM, John Hascall <[email protected]> wrote: > Some code you may find useful to enforce the readonly byte (do this before > your program opens the DB). > John > > #include <fcntl.h> > #include <unistd.h> > #define > > int setRObyte ( > const char * sqDBfn > ) { > int fd = open(sqDBfn, O_WRONLY, 0); > int rc = -1; > > if (fd == -1) return -1; > #ifdef HAVE_PWRITE > if (pwrite(fd, "\143", (size_t)1, (off_t)18) == 1) rc = 0; > #else > if (lseek(fd, (off_t)18, SEEK_SET) == (off_t)18) == 1) ? 0 : -1; > rc = (write(fd, "\143", (size_t)1) == 1) ? 0 : -1; > } else rc = -1; > #endif > (void)close(fd); > return rc; > } > > On Tue, Oct 14, 2014 at 7:23 AM, Richard Hipp <[email protected]> wrote: > >> On Tue, Oct 14, 2014 at 2:19 AM, Ross Altman <[email protected]> >> wrote: >> >> > I need to host a fixed, unchanging database online, and I want to make >> sure >> > that anyone who downloads it cannot add to it. Is there any way to set >> the >> > permissions to be read-only within sqlite? >> > >> >> Change the 18th byte of the file from 1 or 2 to 99. >> >> Anyone who downloads the file can always change that byte back to its >> original value using a binary editor and then write the database. But you >> have at least then made the problem more difficult for them. >> >> -- >> D. Richard Hipp >> [email protected] >> _______________________________________________ >> sqlite-users mailing list >> [email protected] >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > > _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

