[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nmh-commits] CVS: nmh/sbr context_read.c, 1.3, 1.4 context_save.c, 1.2,
From: |
Ken Hornstein <address@hidden> |
Subject: |
[Nmh-commits] CVS: nmh/sbr context_read.c, 1.3, 1.4 context_save.c, 1.2, 1.3 lock_file.c, 1.7, 1.8 seq_read.c, 1.3, 1.4 seq_save.c, 1.3, 1.4 |
Date: |
Fri, 05 Sep 2003 14:36:38 -0400 |
Update of /cvsroot/nmh/nmh/sbr
In directory subversions:/tmp/cvs-serv21719
Modified Files:
context_read.c context_save.c lock_file.c seq_read.c
seq_save.c
Log Message:
Merge in locking fixes into the main line.
Index: context_read.c
===================================================================
RCS file: /cvsroot/nmh/nmh/sbr/context_read.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** context_read.c 18 Nov 2002 18:25:02 -0000 1.3
--- context_read.c 5 Sep 2003 18:36:36 -0000 1.4
***************
*** 125,131 ****
ctxpath = getcpy (m_maildir (cp));
! if ((ib = fopen (ctxpath, "r"))) {
readconfig ((struct node **) 0, ib, cp, 1);
! fclose (ib);
}
--- 125,131 ----
ctxpath = getcpy (m_maildir (cp));
! if ((ib = lkfopen (ctxpath, "r"))) {
readconfig ((struct node **) 0, ib, cp, 1);
! lkfclose (ib);
}
Index: context_save.c
===================================================================
RCS file: /cvsroot/nmh/nmh/sbr/context_save.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** context_save.c 2 Jul 2002 22:09:14 -0000 1.2
--- context_save.c 5 Sep 2003 18:36:36 -0000 1.3
***************
*** 42,51 ****
SIGPROCMASK (SIG_BLOCK, &set, &oset);
! if (!(out = fopen (ctxpath, "w")))
adios (ctxpath, "unable to write");
for (np = m_defs; np; np = np->n_next)
if (np->n_context)
fprintf (out, "%s: %s\n", np->n_name, np->n_field);
! fclose (out);
SIGPROCMASK (SIG_SETMASK, &oset, &set); /* reset the signal mask */
--- 42,51 ----
SIGPROCMASK (SIG_BLOCK, &set, &oset);
! if (!(out = lkfopen (ctxpath, "w")))
adios (ctxpath, "unable to write");
for (np = m_defs; np; np = np->n_next)
if (np->n_context)
fprintf (out, "%s: %s\n", np->n_name, np->n_field);
! lkfclose (out, ctxpath);
SIGPROCMASK (SIG_SETMASK, &oset, &set); /* reset the signal mask */
Index: lock_file.c
===================================================================
RCS file: /cvsroot/nmh/nmh/sbr/lock_file.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** lock_file.c 2 Jul 2002 22:09:14 -0000 1.7
--- lock_file.c 5 Sep 2003 18:36:36 -0000 1.8
***************
*** 202,209 ****
if (strcmp (mode, "r") == 0)
access = O_RDONLY;
! else
access = O_RDWR;
! if ((fd = lkopen (file, access, 0)) == -1)
return NULL;
--- 202,221 ----
if (strcmp (mode, "r") == 0)
access = O_RDONLY;
! else if (strcmp (mode, "r+") == 0)
access = O_RDWR;
+ else if (strcmp (mode, "w") == 0)
+ access = O_WRONLY | O_CREAT | O_TRUNC;
+ else if (strcmp (mode, "w+") == 0)
+ access = O_RDWR | O_CREAT | O_TRUNC;
+ else if (strcmp (mode, "a") == 0)
+ access = O_WRONLY | O_CREAT | O_APPEND;
+ else if (strcmp (mode, "a+") == 0)
+ access = O_RDWR | O_CREAT | O_APPEND;
+ else {
+ errno = EINVAL;
+ return NULL;
+ }
! if ((fd = lkopen (file, access, 0666)) == -1)
return NULL;
***************
*** 315,319 ****
# ifdef FLOCK_LOCKING
! if (flock (fd, LOCK_EX | LOCK_NB) != -1)
return fd;
# endif
--- 327,332 ----
# ifdef FLOCK_LOCKING
! if (flock (fd, (((access & 03) == O_RDONLY) ? LOCK_SH : LOCK_EX)
! | LOCK_NB) != -1)
return fd;
# endif
***************
*** 330,333 ****
--- 343,347 ----
j = errno;
close (fd);
+ admonish (file, "lock did not succeed, waiting");
sleep (5);
}
Index: seq_read.c
===================================================================
RCS file: /cvsroot/nmh/nmh/sbr/seq_read.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** seq_read.c 18 Nov 2002 18:25:02 -0000 1.3
--- seq_read.c 5 Sep 2003 18:36:36 -0000 1.4
***************
*** 23,27 ****
/*
* Get the sequence information for this folder from
! * .mh_sequence (or equivalent specified in .mh_profile)
* or context file (for private sequences).
*/
--- 23,27 ----
/*
* Get the sequence information for this folder from
! * .mh_sequences (or equivalent specified in .mh_profile)
* or context file (for private sequences).
*/
***************
*** 74,78 ****
snprintf (seqfile, sizeof(seqfile), "%s/%s", mp->foldpath, mh_seq);
! if ((fp = fopen (seqfile, "r")) == NULL)
return;
--- 74,78 ----
snprintf (seqfile, sizeof(seqfile), "%s/%s", mp->foldpath, mh_seq);
! if ((fp = lkfopen (seqfile, "r")) == NULL)
return;
***************
*** 112,116 ****
}
! fclose (fp);
}
--- 112,116 ----
}
! lkfclose (fp, seqfile);
}
Index: seq_save.c
===================================================================
RCS file: /cvsroot/nmh/nmh/sbr/seq_save.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** seq_save.c 18 Nov 2002 18:25:02 -0000 1.3
--- seq_save.c 5 Sep 2003 18:36:36 -0000 1.4
***************
*** 77,83 ****
* readonly), then make sequence private.
*/
! if ((fp = fopen (seqfile, "w")) == NULL
&& (unlink (seqfile) == -1 ||
! (fp = fopen (seqfile, "w")) == NULL)) {
admonish (attr, "unable to write");
goto priv;
--- 77,83 ----
* readonly), then make sequence private.
*/
! if ((fp = lkfopen (seqfile, "w")) == NULL
&& (unlink (seqfile) == -1 ||
! (fp = lkfopen (seqfile, "w")) == NULL)) {
admonish (attr, "unable to write");
goto priv;
***************
*** 97,101 ****
if (fp) {
! fclose (fp);
SIGPROCMASK (SIG_SETMASK, &oset, &set); /* reset signal mask */
} else {
--- 97,101 ----
if (fp) {
! lkfclose (fp, seqfile);
SIGPROCMASK (SIG_SETMASK, &oset, &set); /* reset signal mask */
} else {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Nmh-commits] CVS: nmh/sbr context_read.c, 1.3, 1.4 context_save.c, 1.2, 1.3 lock_file.c, 1.7, 1.8 seq_read.c, 1.3, 1.4 seq_save.c, 1.3, 1.4,
Ken Hornstein <address@hidden> <=
- Prev by Date:
[Nmh-commits] CVS: nmh/sbr context_read.c, 1.2.2.1, 1.2.2.2 context_save.c, 1.2, 1.2.2.1 lock_file.c, 1.7, 1.7.2.1 seq_read.c, 1.2.2.1, 1.2.2.2 seq_save.c, 1.2.2.1, 1.2.2.2
- Next by Date:
[Nmh-commits] CVS: nmh/sbr lock_file.c,1.8,1.9
- Previous by thread:
[Nmh-commits] CVS: nmh/sbr context_read.c, 1.2.2.1, 1.2.2.2 context_save.c, 1.2, 1.2.2.1 lock_file.c, 1.7, 1.7.2.1 seq_read.c, 1.2.2.1, 1.2.2.2 seq_save.c, 1.2.2.1, 1.2.2.2
- Next by thread:
[Nmh-commits] CVS: nmh/sbr lock_file.c,1.8,1.9
- Index(es):