PageRenderTime 27ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/CCache/debian/patches/05_nfs_fix.diff

#
Unknown | 45 lines | 43 code | 2 blank | 0 comment | 0 complexity | 4c722c465f522ddab3a91813caa869fb MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. --- ccache.1.orig 2007-05-20 17:30:57.000000000 +1200
  2. +++ ccache.1 2007-05-20 17:31:27.000000000 +1200
  3. @@ -367,12 +367,6 @@
  4. .IP o
  5. ccache avoids a double call to cpp on a cache miss
  6. .PP
  7. -.SH "BUGS"
  8. -.PP
  9. -When the cache is stored on an NFS filesystem, the filesystem must be
  10. -exported with the \fBno_subtree_check\fP option to make renames between
  11. -directories reliable\&.
  12. -.PP
  13. .SH "CREDITS"
  14. .PP
  15. Thanks to the following people for their contributions to ccache
  16. --- util.c.patched 2007-05-20 18:19:11.000000000 +1200
  17. +++ util.c 2007-05-20 18:20:55.000000000 +1200
  18. @@ -58,9 +58,26 @@
  19. }
  20. }
  21. +static int safe_rename(const char* oldpath, const char* newpath)
  22. +{
  23. + /* safe_rename is for creating entries in the cache.
  24. +
  25. + Works like rename(), but it never overwrites an existing
  26. + cache entry. This avoids corruption on NFS. */
  27. + int status = link( oldpath, newpath );
  28. + if( status == 0 || errno == EEXIST )
  29. + {
  30. + return unlink( oldpath );
  31. + }
  32. + else
  33. + {
  34. + return -1;
  35. + }
  36. +}
  37. +
  38. /* move a file using rename */
  39. int move_file(const char *src, const char *dest) {
  40. - return rename(src, dest);
  41. + return safe_rename(src, dest);
  42. }
  43. /* copy a file - used when hard links don't work