is being locked in logging/error messages
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 8.17
SCCS-vsn: usr.sbin/sendmail/src/util.c 8.8
SCCS-vsn: usr.sbin/sendmail/src/queue.c 8.15
SCCS-vsn: usr.sbin/sendmail/src/conf.c 8.26
SCCS-vsn: usr.sbin/sendmail/src/alias.c 8.12
SCCS-vsn: usr.sbin/sendmail/src/map.c 8.9
# include <pwd.h>
#ifndef lint
# include <pwd.h>
#ifndef lint
-static char sccsid[] = "@(#)alias.c 8.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)alias.c 8.12 (Berkeley) %G%";
}
/* see if someone else is rebuilding the alias file */
}
/* see if someone else is rebuilding the alias file */
- if (!lockfile(fileno(af), map->map_file, LOCK_EX|LOCK_NB))
+ if (!lockfile(fileno(af), map->map_file, NULL, LOCK_EX|LOCK_NB))
{
/* yes, they are -- wait until done */
message("Alias file %s is already being rebuilt",
{
/* yes, they are -- wait until done */
message("Alias file %s is already being rebuilt",
if (OpMode != MD_INITALIAS)
{
/* wait for other rebuild to complete */
if (OpMode != MD_INITALIAS)
{
/* wait for other rebuild to complete */
- (void) lockfile(fileno(af), map->map_file,
+ (void) lockfile(fileno(af), map->map_file, NULL,
LOCK_EX);
}
(void) fclose(af);
LOCK_EX);
}
(void) fclose(af);
-static char sccsid[] = "@(#)conf.c 8.25 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c 8.26 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
** Parameters:
** fd -- the file descriptor of the file.
** filename -- the file name (for error messages).
** Parameters:
** fd -- the file descriptor of the file.
** filename -- the file name (for error messages).
+** ext -- the filename extension.
** type -- type of the lock. Bits can be:
** LOCK_EX -- exclusive lock.
** LOCK_NB -- non-blocking.
** type -- type of the lock. Bits can be:
** LOCK_EX -- exclusive lock.
** LOCK_NB -- non-blocking.
-lockfile(fd, filename, type)
+lockfile(fd, filename, ext, type)
int type;
{
# ifndef HASFLOCK
int action;
struct flock lfd;
int type;
{
# ifndef HASFLOCK
int action;
struct flock lfd;
+
+ if (ext == NULL)
+ ext = "";
bzero(&lfd, sizeof lfd);
if (bitset(LOCK_UN, type))
bzero(&lfd, sizeof lfd);
if (bitset(LOCK_UN, type))
action = F_SETLKW;
if (tTd(55, 60))
action = F_SETLKW;
if (tTd(55, 60))
- printf("lockfile(%s, action=%d, type=%d): ",
- filename, action, lfd.l_type);
+ printf("lockfile(%s%s, action=%d, type=%d): ",
+ filename, ext, action, lfd.l_type);
if (fcntl(fd, action, &lfd) >= 0)
{
if (fcntl(fd, action, &lfd) >= 0)
{
}
if (!bitset(LOCK_NB, type) || (errno != EACCES && errno != EAGAIN))
}
if (!bitset(LOCK_NB, type) || (errno != EACCES && errno != EAGAIN))
- syserr("cannot lockf(%s, %o)", filename, type);
+ syserr("cannot lockf(%s%s, %o)", filename, ext, type);
+ if (ext == NULL)
+ ext = "";
+
- printf("lockfile(%s, type=%o): ", filename, type);
+ printf("lockfile(%s%s, type=%o): ", filename, ext, type);
if (flock(fd, type) >= 0)
{
if (flock(fd, type) >= 0)
{
printf("(%s) ", errstring(errno));
if (!bitset(LOCK_NB, type) || errno != EWOULDBLOCK)
printf("(%s) ", errstring(errno));
if (!bitset(LOCK_NB, type) || errno != EWOULDBLOCK)
- syserr("cannot flock(%s, %o)", filename, type);
+ syserr("cannot flock(%s%s, %o)", filename, ext, type);
# endif
if (tTd(55, 60))
printf("FAIL\n");
# endif
if (tTd(55, 60))
printf("FAIL\n");
-static char sccsid[] = "@(#)map.c 8.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)map.c 8.9 (Berkeley) %G%";
#endif /* not lint */
#include "sendmail.h"
#endif /* not lint */
#include "sendmail.h"
makelower(keybuf);
key.dptr = keybuf;
}
makelower(keybuf);
key.dptr = keybuf;
}
- (void) lockfile(dbm_dirfno((DBM *) map->map_db1), map->map_file, LOCK_SH);
+ (void) lockfile(dbm_dirfno((DBM *) map->map_db1), map->map_file,
+ ".dir", LOCK_SH);
val.dptr = NULL;
if (bitset(MF_TRY0NULL, map->map_mflags))
{
val.dptr = NULL;
if (bitset(MF_TRY0NULL, map->map_mflags))
{
if (val.dptr != NULL)
map->map_mflags &= ~MF_TRY0NULL;
}
if (val.dptr != NULL)
map->map_mflags &= ~MF_TRY0NULL;
}
- (void) lockfile(dbm_dirfno((DBM *) map->map_db1), map->map_file, LOCK_UN);
+ (void) lockfile(dbm_dirfno((DBM *) map->map_db1), map->map_file,
+ ".dir", LOCK_UN);
if (val.dptr == NULL)
return NULL;
if (bitset(MF_MATCHONLY, map->map_mflags))
if (val.dptr == NULL)
return NULL;
if (bitset(MF_MATCHONLY, map->map_mflags))
#if !defined(OLD_NEWDB) && defined(HASFLOCK)
# if !defined(O_EXLOCK)
if (mode == O_RDWR)
#if !defined(OLD_NEWDB) && defined(HASFLOCK)
# if !defined(O_EXLOCK)
if (mode == O_RDWR)
- (void) lockfile(db->fd(db), map->map_file, LOCK_EX);
+ (void) lockfile(db->fd(db), map->map_file, ".db", LOCK_EX);
# else
if (mode == O_RDONLY)
# else
if (mode == O_RDONLY)
- (void) lockfile(db->fd(db), map->map_file, LOCK_UN);
+ (void) lockfile(db->fd(db), map->map_file, ".db", LOCK_UN);
#if !defined(OLD_NEWDB) && defined(HASFLOCK)
# if !defined(O_EXLOCK)
if (mode == O_RDWR)
#if !defined(OLD_NEWDB) && defined(HASFLOCK)
# if !defined(O_EXLOCK)
if (mode == O_RDWR)
- (void) lockfile(db->fd(db), map->map_file, LOCK_EX);
+ (void) lockfile(db->fd(db), map->map_file, ".db", LOCK_EX);
# else
if (mode == O_RDONLY)
# else
if (mode == O_RDONLY)
- (void) lockfile(db->fd(db), map->map_file, LOCK_UN);
+ (void) lockfile(db->fd(db), map->map_file, ".db", LOCK_UN);
if (!bitset(MF_NOFOLDCASE, map->map_mflags))
makelower(keybuf);
#ifndef OLD_NEWDB
if (!bitset(MF_NOFOLDCASE, map->map_mflags))
makelower(keybuf);
#ifndef OLD_NEWDB
- (void) lockfile(db->fd(db), map->map_file, LOCK_SH);
+ (void) lockfile(db->fd(db), map->map_file, ".db", LOCK_SH);
#endif
st = 1;
if (bitset(MF_TRY0NULL, map->map_mflags))
#endif
st = 1;
if (bitset(MF_TRY0NULL, map->map_mflags))
}
saveerrno = errno;
#ifndef OLD_NEWDB
}
saveerrno = errno;
#ifndef OLD_NEWDB
- (void) lockfile(db->fd(db), map->map_file, LOCK_UN);
+ (void) lockfile(db->fd(db), map->map_file, ".db", LOCK_UN);
#ifndef lint
#ifdef QUEUE
#ifndef lint
#ifdef QUEUE
-static char sccsid[] = "@(#)queue.c 8.14 (Berkeley) %G% (with queueing)";
+static char sccsid[] = "@(#)queue.c 8.15 (Berkeley) %G% (with queueing)";
-static char sccsid[] = "@(#)queue.c 8.14 (Berkeley) %G% (without queueing)";
+static char sccsid[] = "@(#)queue.c 8.15 (Berkeley) %G% (without queueing)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
- if (lockfile(fd, tf, LOCK_EX|LOCK_NB))
+ if (lockfile(fd, tf, NULL, LOCK_EX|LOCK_NB))
break;
#ifdef LOG
else if (LogLevel > 0 && (i % 32) == 0)
break;
#ifdef LOG
else if (LogLevel > 0 && (i % 32) == 0)
- if (!lockfile(fileno(qfp), qf, LOCK_EX|LOCK_NB))
+ if (!lockfile(fileno(qfp), qf, NULL, LOCK_EX|LOCK_NB))
{
/* being processed by another queuer */
if (tTd(40, 8))
{
/* being processed by another queuer */
if (tTd(40, 8))
continue;
}
printf("%8s", w->w_name + 2);
continue;
}
printf("%8s", w->w_name + 2);
- if (!lockfile(fileno(f), w->w_name, LOCK_SH|LOCK_NB))
+ if (!lockfile(fileno(f), w->w_name, NULL, LOCK_SH|LOCK_NB))
printf("*");
else if (shouldqueue(w->w_pri, w->w_ctime))
printf("X");
printf("*");
else if (shouldqueue(w->w_pri, w->w_ctime))
printf("X");
qf, QueueDir);
exit(EX_UNAVAILABLE);
}
qf, QueueDir);
exit(EX_UNAVAILABLE);
}
- if (lockfile(i, qf, LOCK_EX|LOCK_NB))
+ if (lockfile(i, qf, NULL, LOCK_EX|LOCK_NB))
{
e->e_lockfp = fdopen(i, "w");
break;
{
e->e_lockfp = fdopen(i, "w");
break;
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)sendmail.h 8.16 (Berkeley) %G%
+ * @(#)sendmail.h 8.17 (Berkeley) %G%
# ifdef _DEFINE
# define EXTERN
# ifndef lint
# ifdef _DEFINE
# define EXTERN
# ifndef lint
-static char SmailSccsId[] = "@(#)sendmail.h 8.16 %G%";
+static char SmailSccsId[] = "@(#)sendmail.h 8.17 %G%";
# endif
# else /* _DEFINE */
# define EXTERN extern
# endif
# else /* _DEFINE */
# define EXTERN extern
extern char *anynet_ntoa __P((SOCKADDR *));
extern char *remotename __P((char *, MAILER *, int, int *, ENVELOPE *));
extern bool shouldqueue __P((long, time_t));
extern char *anynet_ntoa __P((SOCKADDR *));
extern char *remotename __P((char *, MAILER *, int, int *, ENVELOPE *));
extern bool shouldqueue __P((long, time_t));
-extern bool lockfile __P((int, char *, int));
+extern bool lockfile __P((int, char *, char *, int));
extern char *hostsignature __P((MAILER *, char *, ENVELOPE *));
extern void openxscript __P((ENVELOPE *));
extern void closexscript __P((ENVELOPE *));
extern char *hostsignature __P((MAILER *, char *, ENVELOPE *));
extern void openxscript __P((ENVELOPE *));
extern void closexscript __P((ENVELOPE *));
-static char sccsid[] = "@(#)util.c 8.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)util.c 8.8 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
locktype = LOCK_EX;
else
locktype = LOCK_SH;
locktype = LOCK_EX;
else
locktype = LOCK_SH;
- (void) lockfile(fd, filename, locktype);
+ (void) lockfile(fd, filename, NULL, locktype);