Fossil

Check-in [d8935a89]
Login

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

Overview
Comment:Fix an inintiialized variable in the previous check-in.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:d8935a89b51b0f8f9286209ba756bb1cc0a4f85b
User & Date: drh 2010-11-08 19:31:30
Context
2010-11-08
20:04
merge from trunk check-in: 1e801695 user: wolfgang tags: StvPrivateHook2
20:01
Fix a bug in the manifest parser which caused it to ignore manifests that were signed by a windows-build of PGP. check-in: 696668aa user: drh tags: trunk
19:31
Fix an inintiialized variable in the previous check-in. check-in: d8935a89 user: drh tags: trunk
19:23
Fix a corner-case in file_tree_name() - specifically when the input is the name of the root of the local tree, return ".". check-in: f98114c9 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/file.c.

430
431
432
433
434
435
436

437
438
439
440
441
442
443
...
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
*/
int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){
  int n;
  Blob full;
  int nFull;
  char *zFull;


  db_must_be_within_tree();
  file_canonical_name(zOrigName, &full);
  n = strlen(g.zLocalRoot);
  assert( n>0 && g.zLocalRoot[n-1]=='/' );
  nFull = blob_size(&full);
  zFull = blob_buffer(&full);

................................................................................
  if( nFull<=n || memcmp(g.zLocalRoot, zFull, n) ){
    blob_reset(&full);
    if( errFatal ){
      fossil_fatal("file outside of checkout tree: %s", zOrigName);
    }
    return 0;
  }
  blob_zero(pOut);
  blob_append(pOut, &zFull[n], nFull-n);
  return 1;
}

/*
** COMMAND:  test-tree-name
**







>







 







<







430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
...
451
452
453
454
455
456
457

458
459
460
461
462
463
464
*/
int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){
  int n;
  Blob full;
  int nFull;
  char *zFull;

  blob_zero(pOut);
  db_must_be_within_tree();
  file_canonical_name(zOrigName, &full);
  n = strlen(g.zLocalRoot);
  assert( n>0 && g.zLocalRoot[n-1]=='/' );
  nFull = blob_size(&full);
  zFull = blob_buffer(&full);

................................................................................
  if( nFull<=n || memcmp(g.zLocalRoot, zFull, n) ){
    blob_reset(&full);
    if( errFatal ){
      fossil_fatal("file outside of checkout tree: %s", zOrigName);
    }
    return 0;
  }

  blob_append(pOut, &zFull[n], nFull-n);
  return 1;
}

/*
** COMMAND:  test-tree-name
**