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 Unified Diffs Ignore Whitespace Patch

Changes to sqlarfs.c.

215
216
217
218
219
220
221

222
223
224
225
226
227
228
229
230
...
232
233
234
235
236
237
238





239







240
241
  .getattr = sqlarfs_getattr,
  .readdir = sqlarfs_readdir,
  .open   	= sqlarfs_open,
  .read    = sqlarfs_read,
};
int main(int argc, char **argv){
  int rc;

  if( argc<2 ){
    fprintf(stderr, "Usage: %s SQLAR-ARCHIVE [-d] [-s] [-f] MOUNT-POINT\n",
            argv[0]);
    exit(1);
  }
  rc = sqlite3_open(argv[1], &g.db);
  if( rc!=SQLITE_OK ){
    fprintf(stderr, "Cannot open sqlar file [%s]\n", argv[1]);
    exit(1);
................................................................................
  rc = sqlite3_exec(g.db, "SELECT 1 FROM sqlar LIMIT 1", 0, 0, 0);
  if( rc!=SQLITE_OK ){
    fprintf(stderr, "File [%s] is not an SQLite archive\n", argv[1]);
    exit(1);
  }
  g.uid = getuid();
  g.gid = getgid();





  rc = fuse_main(argc-1, argv+1, &sqlarfs_methods, NULL);







  return rc;
}







>
|
|







 







>
>
>
>
>
|
>
>
>
>
>
>
>


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