SQLite Archiver
Check-in [ed4e6af2e8]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In sqlarfs (the Fuse FS driver for SQLite archives) make sure it always runs in the foreground. And after it stops, clean up prepared statements and memory allocations and close the database connection before exiting.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ed4e6af2e898dbec8b13ff732522d0e764f06f1f
User & Date: drh 2014-06-14 17:20:10
Context
2014-08-15
19:01
Update the built-in SQLite to version 3.8.6. check-in: 95ee3b3708 user: drh tags: trunk
2014-06-14
17:20
In sqlarfs (the Fuse FS driver for SQLite archives) make sure it always runs in the foreground. And after it stops, clean up prepared statements and memory allocations and close the database connection before exiting. check-in: ed4e6af2e8 user: drh tags: trunk
2014-06-13
18:32
Add a short mention of the FuseFS adaptor to the documentation and homepage. check-in: aab6f9cff9 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to sqlarfs.c.

   215    215     .getattr = sqlarfs_getattr,
   216    216     .readdir = sqlarfs_readdir,
   217    217     .open   	= sqlarfs_open,
   218    218     .read    = sqlarfs_read,
   219    219   };
   220    220   int main(int argc, char **argv){
   221    221     int rc;
   222         -  if( argc<2 ){
   223         -    fprintf(stderr, "Usage: %s SQLAR-ARCHIVE [-d] [-s] [-f] MOUNT-POINT\n",
          222  +  char *azNewArg[5];
          223  +  if( argc!=3 ){
          224  +    fprintf(stderr, "Usage: %s SQLAR-ARCHIVE MOUNT-POINT\n",
   224    225               argv[0]);
   225    226       exit(1);
   226    227     }
   227    228     rc = sqlite3_open(argv[1], &g.db);
   228    229     if( rc!=SQLITE_OK ){
   229    230       fprintf(stderr, "Cannot open sqlar file [%s]\n", argv[1]);
   230    231       exit(1);
................................................................................
   232    233     rc = sqlite3_exec(g.db, "SELECT 1 FROM sqlar LIMIT 1", 0, 0, 0);
   233    234     if( rc!=SQLITE_OK ){
   234    235       fprintf(stderr, "File [%s] is not an SQLite archive\n", argv[1]);
   235    236       exit(1);
   236    237     }
   237    238     g.uid = getuid();
   238    239     g.gid = getgid();
   239         -  rc = fuse_main(argc-1, argv+1, &sqlarfs_methods, NULL);
          240  +  azNewArg[0] = argv[0];
          241  +  azNewArg[1] = "-f";
          242  +  azNewArg[2] = "-s";
          243  +  azNewArg[3] = argv[2];
          244  +  azNewArg[4] = 0;
          245  +  rc = fuse_main(4, azNewArg, &sqlarfs_methods, NULL);
          246  +  sqlite3_finalize(g.pStat);
          247  +  sqlite3_finalize(g.pFList);
          248  +  sqlite3_finalize(g.pExists);
          249  +  sqlite3_finalize(g.pRead);
          250  +  sqlite3_free(g.zCacheName);
          251  +  sqlite3_free(g.zCacheData);
          252  +  sqlite3_close(g.db);
   240    253     return rc;
   241    254   }