bugThe nmh Mail Handling System - Bugs: bug #9863, dotlocking not working properly

 
 

bug #9863: dotlocking not working properly

Submitter:  None
Submitted:  Tue 03 Aug 2004 11:02:22 PM UTC
   
 
Category:  compatibility Severity:  3 - Normal
Priority:  * 5 - Normal Status:  Fixed
Assigned to:  None Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 09 Nov 2005 10:35:07 PM UTC, comment #1: 

This bug was fixed (in a different way) by this checkin:

sbr/lock_file.c Revision 1.11 Tue Oct 12 20:40:25 2004 UTC (12 months, 4 weeks ago) by jon

Fixed strange bug that prevented a lock from ever being obtained if getting it failed the first time.  The problem was that the string of XXXXXX that is required by mkstemp() was overwritten the first time through, and so all subsequent times failed because mkstemp() failed.  The fix reinitializes the tmp file string.

So I'm closing this bug.

Peter Maydell <pm215>
Group administrator
Tue 03 Aug 2004 11:02:22 PM UTC, original submission:  

In routine lockit() of lock_file.c, the mkstemp(tmplock) call modifies the template in tmplock after it has failed (this is on Fedora).  The modified tmplock, which is kept around in nmh, makes subsequent mkstemp calls fail and the locking never succeeds.

Here is a patch:

--- sbr/lock_file.c     2004/07/30 23:27:11     1.1
+++ sbr/lock_file.c     2004/08/02 17:22:37
@@ -425,14 +510,15 @@
 lockit (struct lockinfo *li)
 {
     int fd;
-    char *curlock, *tmplock;
+    char *curlock, tmplock[sizeof(li->tmplock)];

 #if 0
     char buffer[128];
 #endif

     curlock = li->curlock;
-    tmplock = li->tmplock;
+    (void) strncpy(tmplock, li->tmplock, sizeof(tmplock) - 1);
+    tmplock[sizeof(tmplock)-1] = '\0';

 #ifdef HAVE_MKSTEMP
     if ((fd = mkstemp(tmplock)) == -1)



Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one

Digest:
   bug dependencies.

 

CC list is empty

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-11-09 pm215 Open/ClosedOpen Closed
2005-11-09 pm215 StatusNone Fixed
2005-11-09 bress Dependencies- bugs #14940 is dependent

Back to the top

Powered by Savane 3.13-f8d8.
Corresponding source code