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

Post a Comment

Add a New Comment Rich Markup
   

Discussion

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

 

Attached Files

This item currently has no attached files.

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

Items that depend on this one

Digest:
   bug dependencies.

 

Mail Notification Carbon-Copy List

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

History

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.16-598c.
Corresponding source code