"Fossies" - the Fresh Open Source Software Archive

Member "swig-4.1.1/CCache/debian/patches/05_nfs_fix.diff" (30 Nov 2022, 1223 Bytes) of package /linux/misc/swig-4.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Diff source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    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  
   22 +static int safe_rename(const char* oldpath, const char* newpath)
   23 +{
   24 +    /* safe_rename is for creating entries in the cache.
   25 +
   26 +       Works like rename(), but it never overwrites an existing
   27 +       cache entry. This avoids corruption on NFS. */
   28 +    int status = link( oldpath, newpath );
   29 +    if( status == 0 || errno == EEXIST )
   30 +    {
   31 +   return unlink( oldpath );
   32 +    }
   33 +    else
   34 +    {
   35 +   return -1;
   36 +    }
   37 +}
   38 + 
   39  /* move a file using rename */
   40  int move_file(const char *src, const char *dest) {
   41 -   return rename(src, dest);
   42 +   return safe_rename(src, dest);
   43  }
   44  
   45  /* copy a file - used when hard links don't work