bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rename bug on OpenVMS - Patch


From: Patrick Spinler
Subject: rename bug on OpenVMS - Patch
Date: Mon, 03 Dec 2001 09:40:33 -0600

All:

On OpenVMS if you try to call the C runtime library "rename" function
where the target file already exists and has only read privileges, the
rename call with error.

This happens in CVS if you've set your repository to strict locking
(admin -L), user 1 commits a file, and user 2 does a "cvs update".

The following patch (against cvs 1.11) works around this issue.  

Comments please ?

--- cvs-original/cvs-1_11/src/filesubr.c        Tue Jul 11 15:32:02 2000
+++ cvs-1_11/src/filesubr.c     Mon Dec  3 09:24:28 2001
@@ -395,14 +395,25 @@
     const char *from;
     const char *to;
 {
+    int change_to_read = 0;
+
     if (trace)
        (void) fprintf (stderr, "%s-> rename(%s,%s)\n",
                        CLIENT_SERVER_STR, from, to);
     if (noexec)
        return;

+    if (ifaccessible (to, F_OK) && ! isaccessible (to, W_OK))
+       {
+       xchmod (to, 1);
+       change_to_read = 1;
+       }
+
     if (rename (from, to) < 0)
        error (1, errno, "cannot rename file %s to %s", from, to);
+
+    if (change_to_read);
+       xchmod (to, 0);
 }

 /*


-- 
      This message does not represent the policies or positions
             of the Mayo Foundation or its subsidiaries.
  Patrick Spinler                       email:  Spinler.Patrick@Mayo.EDU
  Mayo Foundation                       phone:  507/284-9485



reply via email to

[Prev in Thread] Current Thread [Next in Thread]