Fossil

Check-in [bb15d408]
Login

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

Overview
Comment:proposed fix for clobbering existing files [5ba427be8809342c6fbdcf48c9c8365467048d28]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | clobber_fixer
Files: files | file ages | folders
SHA1:bb15d408a4d68f8ab853e4dc6d2a00c51a33d24e
User & Date: bch 2015-01-29 20:21:43
References
2015-01-29
20:42 Ticket [5ba427be] Fossil clobbers existing files when creating new repo status still Open with 3 other changes artifact: e4b733e1 user: nobody
Context
2015-01-29
22:15
move "solution" closer to problem area, rather than too deeply abstracted in the machinery. check-in: 89cf250d user: bch tags: clobber_fixer
20:54
less abstract, closer to affected (clone, init/new) subcommands Closed-Leaf check-in: b0a3bfb0 user: bch tags: clobber_fixer
20:21
proposed fix for clobbering existing files [5ba427be8809342c6fbdcf48c9c8365467048d28] check-in: bb15d408 user: bch tags: clobber_fixer
09:14
Changelog additions, and a single "const" addition check-in: 9586ac14 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/db.c.

815
816
817
818
819
820
821

822
823





824
825
826
827
828
829
830
/*
** Open a database file.  Return a pointer to the new database
** connection.  An error results in process abort.
*/
LOCAL sqlite3 *db_open(const char *zDbName){
  int rc;
  sqlite3 *db;


  if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName);





  rc = sqlite3_open_v2(
       zDbName, &db,
       SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
       g.zVfsName
  );
  if( rc!=SQLITE_OK ){
    db_err("[%s]: %s", zDbName, sqlite3_errmsg(db));







>


>
>
>
>
>







815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
/*
** Open a database file.  Return a pointer to the new database
** connection.  An error results in process abort.
*/
LOCAL sqlite3 *db_open(const char *zDbName){
  int rc;
  sqlite3 *db;
  struct stat sb;

  if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName);

  if (0 == stat(zDbName, &sb)) {
       db_err("[%s]: %s", zDbName, "File already exists.");
  }

  rc = sqlite3_open_v2(
       zDbName, &db,
       SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
       g.zVfsName
  );
  if( rc!=SQLITE_OK ){
    db_err("[%s]: %s", zDbName, sqlite3_errmsg(db));