pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Check that the lockfile isn't stale from being left...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/87a253de4393
branches:  trunk
changeset: 461000:87a253de4393
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Tue Sep 09 11:00:30 2003 +0000

description:
Check that the lockfile isn't stale from being left over across a system
reboot by testing whether or not /var/run/dmesg.boot is newer than it or
not.  Fix suggested by agc%NetBSD.org@localhost and simonb%NetBSD.org@localhost.

diffstat:

 mk/bsd.pkg.mk |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (21 lines):

diff -r e79e9b0f2b97 -r 87a253de4393 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Tue Sep 09 10:03:50 2003 +0000
+++ b/mk/bsd.pkg.mk     Tue Sep 09 11:00:30 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1265 2003/09/08 01:13:02 jlam Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1266 2003/09/09 11:00:30 jlam Exp $
 #
 # This file is in the public domain.
 #
@@ -1888,6 +1888,11 @@
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
        ppid=`${PS} -p $$$$ -o ppid | ${AWK} 'NR == 2 { print $$1 }'`;  \
        while true; do                                                  \
+               if [ -f /var/run/dmesg.boot -a -f ${LOCKFILE} -a        \
+                    /var/run/dmesg.boot -nt ${LOCKFILE} ]; then        \
+                       ${ECHO} "=> Removing stale ${LOCKFILE}";        \
+                       ${RM} ${LOCKFILE};                              \
+               fi;                                                     \
                ${SHLOCK} -f ${LOCKFILE} -p $$ppid && break;            \
                ${ECHO} "=> Lock is held by pid `cat ${LOCKFILE}`";     \
                case "${PKGSRC_LOCKTYPE}" in                            \



Home | Main Index | Thread Index | Old Index