update to 1.4-7; generate news user if necessary;
use BSD install programs, not cp; mktemp -> mkstemp; setreuid -> setuid; update packing list; don't even try to build a package as it won't install correctly
This commit is contained in:
parent
9fc633cff3
commit
4fca24adba
@ -1,22 +1,21 @@
|
||||
# OpenBSD makefile for: leafnode
|
||||
# Version required: 1.0.2
|
||||
# Version required: 1.4-7
|
||||
# Date created: 19 Dec 1997
|
||||
# Whom: joey
|
||||
#
|
||||
# $OpenBSD: Makefile,v 1.1.1.1 1997/12/20 02:03:08 joey Exp $
|
||||
# $OpenBSD: Makefile,v 1.2 1998/07/25 06:16:10 marc Exp $
|
||||
#
|
||||
|
||||
DISTNAME= leafnode-1.0.2
|
||||
CATEGORIES= news
|
||||
MASTER_SITES= ${MASTER_SITE_SUNSITE}
|
||||
DISTNAME= leafnode-1.4-7
|
||||
PKGNAME= leafnode-1.4.7
|
||||
CATEGORIES= news
|
||||
|
||||
MAINTAINER= marc@OpenBSD.ORG
|
||||
|
||||
MASTER_SITES= ${MASTER_SITE_SUNSITE}
|
||||
MASTER_SITE_SUBDIR= system/news/readers
|
||||
EXTRACT_SUFX= .src.elf.tgz
|
||||
EXTRACT_SUFX= .src.elf.tar.gz
|
||||
|
||||
MAINTAINER= joey@OpenBSD.ORG
|
||||
|
||||
MAN8= fetch.8 leafnode.8 texpire.8
|
||||
|
||||
post-install:
|
||||
strip ${PREFIX}/sbin/fetch ${PREFIX}/sbin/leafnode ${PREFIX}/sbin/texpire
|
||||
NO_PACKAGE= "won't install correctly"
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1 +1 @@
|
||||
MD5 (leafnode-1.0.2.src.elf.tgz) = 525afc4a4b99962de82dbf9cc8148cf9
|
||||
MD5 (leafnode-1.4-7.src.elf.tar.gz) = db921095821f58e644ac77bd88bfac87
|
||||
|
@ -1,12 +1,114 @@
|
||||
*** fetch.c.orig Fri Jul 4 10:32:32 1997
|
||||
--- fetch.c Fri Jul 4 10:32:39 1997
|
||||
***************
|
||||
*** 14,20 ****
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
- #include <malloc.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <pwd.h>
|
||||
--- 14,19 ----
|
||||
--- Makefile.orig Sun Mar 1 11:48:31 1998
|
||||
+++ Makefile Fri Jul 24 22:58:37 1998
|
||||
@@ -4,7 +4,7 @@
|
||||
DEBUG = $(RPM_OPT_FLAGS) -O2 -Wall -Wformat -Wstrict-prototypes -Wmissing-prototypes
|
||||
CFLAGS = $(DEBUG)
|
||||
LIBS =
|
||||
-PREFIX_USR = /usr
|
||||
+PREFIX_USR = ${PREFIX}
|
||||
PREFIX_VAR = /var
|
||||
BINDIR = $(PREFIX_USR)/sbin
|
||||
MANDIR = $(PREFIX_USR)/man
|
||||
@@ -13,13 +13,18 @@
|
||||
# this is the directory where the news is stored.
|
||||
SPOOLDIR = $(PREFIX_VAR)/spool/news
|
||||
#
|
||||
-# this is the directory where the configuration and group information is
|
||||
-# kept. It should preferably not be on the same partition as spooldir
|
||||
+# ETCDIR is where the program will look for configuration and
|
||||
+# group information, LIBDIR is where an example configuration
|
||||
+# file will be placed.
|
||||
+# They should preferably not be on the same partition as spooldir
|
||||
LIBDIR = $(PREFIX_USR)/lib/leafnode
|
||||
+ETCDIR = /etc/leafnode
|
||||
+
|
||||
#
|
||||
# This is the lock file for fetch. The normal locations for such lock
|
||||
# files are /var/run or /var/lock.
|
||||
-LOCKFILE = "/var/run/news/fetch.lck"
|
||||
+LOCKDIR = ${PREFIX_VAR}/run/news
|
||||
+LOCKFILE = ${LOCKDIR}/fetch.lck
|
||||
|
||||
all: nntpd fetch texpire checkgroups
|
||||
|
||||
@@ -43,7 +48,7 @@
|
||||
|
||||
config.o: config.c Makefile
|
||||
$(CC) -c -DSPOOLDIR=\"$(SPOOLDIR)\" \
|
||||
- -DLIBDIR=\"$(LIBDIR)\" \
|
||||
+ -DLIBDIR=\"$(ETCDIR)\" \
|
||||
-DLOCKFILE=\"$(LOCKFILE)\" \
|
||||
-DVERSION=\"$(VERSION)\" $<
|
||||
|
||||
@@ -53,23 +58,23 @@
|
||||
cp texpire $(BINDIR)/texpire
|
||||
cp checkgroups $(BINDIR)/checkgroups
|
||||
cp *.8 $(MANDIR)/man8
|
||||
- -mkdir -p /var/run/news
|
||||
- chown news.news /var/run/news
|
||||
+ -mkdir -p ${LOCKDIR}
|
||||
+ chown news.news ${LOCKDIR}
|
||||
chmod 750 $(BINDIR)/{leafnode,fetch,texpire,checkgroups}
|
||||
chown news.news $(BINDIR)/{leafnode,fetch,texpire,checkgroups}
|
||||
|
||||
install: nntpd fetch texpire checkgroups
|
||||
- cp nntpd $(BINDIR)/leafnode
|
||||
- cp fetch $(BINDIR)/fetch
|
||||
- cp texpire $(BINDIR)/texpire
|
||||
- cp checkgroups $(BINDIR)/checkgroups
|
||||
- cp newsq $(BINDIR)/newsq
|
||||
- cp texpire.cron $(BINDIR)/texpire.cron
|
||||
- cp *.8 $(MANDIR)/man8
|
||||
- cp newsq.1 $(MANDIR)/man1
|
||||
- -mkdir -p $(PREFIX_VAR)/run/news
|
||||
- chown news.news $(PREFIX_VAR)/run/news
|
||||
- -mkdir -p $(SPOOLDIR) $(LIBDIR)
|
||||
+ ${BSD_INSTALL_PROGRAM} nntpd $(BINDIR)/leafnode
|
||||
+ ${BSD_INSTALL_PROGRAM} fetch $(BINDIR)/fetch
|
||||
+ ${BSD_INSTALL_PROGRAM} texpire $(BINDIR)/texpire
|
||||
+ ${BSD_INSTALL_PROGRAM} checkgroups $(BINDIR)/checkgroups
|
||||
+ ${BSD_INSTALL_PROGRAM} newsq $(BINDIR)/newsq
|
||||
+ ${BSD_INSTALL_PROGRAM} texpire.cron $(BINDIR)/texpire.cron
|
||||
+ ${BSD_INSTALL_MAN} *.8 $(MANDIR)/man8
|
||||
+ ${BSD_INSTALL_MAN} newsq.1 $(MANDIR)/man1
|
||||
+ -mkdir -p $(LOCKDIR)
|
||||
+ chown news.news $(LOCKDIR)
|
||||
+ -mkdir -p $(SPOOLDIR) $(LIBDIR) $(ETCDIR)
|
||||
-mkdir -p $(SPOOLDIR)/{message.id,interesting.groups,out.going,failed.postings}
|
||||
cd $(SPOOLDIR)/message.id ; for a in 0 1 2 3 4 5 6 7 8 9 ; do \
|
||||
for b in 0 1 2 3 4 5 6 7 8 9 ; do \
|
||||
@@ -78,12 +83,20 @@
|
||||
$${a}$${b}6 $${a}$${b}7 $${a}$${b}8 \
|
||||
$${a}$${b}9 ; \
|
||||
done ; done
|
||||
- cp config.example $(LIBDIR)/config
|
||||
- chown -R news.news $(LIBDIR) $(SPOOLDIR)
|
||||
+ ${BSD_INSTALL_DATA} README INSTALL config.example $(LIBDIR)
|
||||
+ test -f $(ETCDIR)/config || \
|
||||
+ ${BSD_INSTALL_DATA} config.example $(ETCDIR)/config
|
||||
+ chown -R news.news $(ETCDIR) $(LIBDIR) $(SPOOLDIR)
|
||||
chmod 2750 $(SPOOLDIR)
|
||||
chmod 750 $(BINDIR)/{leafnode,fetch,texpire,checkgroups,newsq,texpire.cron}
|
||||
chown news.news $(BINDIR)/{leafnode,fetch,texpire,checkgroups,newsq,texpire.cron}
|
||||
- @echo edit /etc/inetd.conf to start $(BINDIR)/leafnode
|
||||
+ @echo ""
|
||||
+ @echo "*** edit /etc/inetd.conf to start $(BINDIR)/leafnode"
|
||||
+ @echo "*** Verify $(ETCDIR)/config -- a copy of which is saved"
|
||||
+ @echo "*** as $(LIBDIR)/config.example."
|
||||
+ @echo "*** See $(LIBDIR)/README" and
|
||||
+ @echo "*** $(LIBDIR)/INSTALL for more information"
|
||||
+ @echo ""
|
||||
|
||||
install-bin:
|
||||
cp linux.bin/nntpd $(BINDIR)/leafnode
|
||||
@@ -94,8 +107,8 @@
|
||||
cp texpire.cron $(BINDIR)/texpire.cron
|
||||
cp *.8 $(MANDIR)/man8
|
||||
cp newsq.1 $(MANDIR)/man1
|
||||
- -mkdir -p $(PREFIX_VAR)/run/news
|
||||
- chown news.news $(PREFIX_VAR)/run/news
|
||||
+ -mkdir -p $(LOCKDIR)
|
||||
+ chown news.news $(LOCKDIR)
|
||||
-mkdir -p $(SPOOLDIR) $(LIBDIR)
|
||||
-mkdir -p $(SPOOLDIR)/{message.id,interesting.groups,out.going,failed.postings}
|
||||
cd $(SPOOLDIR)/message.id ; for a in 0 1 2 3 4 5 6 7 8 9 ; do \
|
||||
|
@ -1,33 +1,30 @@
|
||||
*** util.c.orig Fri Jul 4 10:29:40 1997
|
||||
--- util.c Fri Jul 4 10:32:43 1997
|
||||
***************
|
||||
*** 16,22 ****
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
- #include <malloc.h>
|
||||
#include <netdb.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
--- 16,21 ----
|
||||
***************
|
||||
*** 485,491 ****
|
||||
|
||||
strcpy(s, libdir);
|
||||
strcat(s, "/groupinfo");
|
||||
- fd = open( s, O_RDONLY );
|
||||
if ( stat( s, &st ) ) {
|
||||
syslog( LOG_ERR, "can't stat %s: %m", s );
|
||||
return;
|
||||
--- 484,489 ----
|
||||
***************
|
||||
*** 494,499 ****
|
||||
--- 492,499 ----
|
||||
if ( (fd=open( s, O_RDONLY))<0 ||
|
||||
(read( fd, stuff, st.st_size ) < st.st_size) ) {
|
||||
syslog( LOG_ERR, "can't open/read %s: %m", s );
|
||||
+ if (fd >= 0)
|
||||
+ close( fd );
|
||||
return;
|
||||
} else {
|
||||
close( fd );
|
||||
--- util.c.~1~ Sun Mar 1 09:50:07 1998
|
||||
+++ util.c Fri Jul 24 22:09:07 1998
|
||||
@@ -1172,7 +1172,7 @@
|
||||
supplement = ns;
|
||||
} else {
|
||||
syslog( LOG_ERR,
|
||||
- "impossibility 122", s );
|
||||
+ "impossibility 122" );
|
||||
exit( 2 );
|
||||
}
|
||||
} else {
|
||||
@@ -1686,7 +1686,7 @@
|
||||
error, getcwd( s, 1024 ) );
|
||||
|
||||
strcpy( newfile, ".overview.XXXXXX" );
|
||||
- if ( (wfd=open( mktemp(newfile), O_WRONLY|O_CREAT|O_EXCL, 0664 )) ) {
|
||||
+ if ( (wfd=mkstemp(newfile)) != -1 ) {
|
||||
struct iovec oooh[UIO_MAXIOV];
|
||||
int vi, vc, va;
|
||||
|
||||
@@ -1739,8 +1739,7 @@
|
||||
.overview file I think */
|
||||
}
|
||||
} else {
|
||||
- syslog( LOG_ERR, "open(O_WRONLY|O_CREAT|O_EXCL) of new "
|
||||
- ".overview failed: %m" );
|
||||
+ syslog( LOG_ERR, "mkstemp of new .overview failed: %m" );
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -1,69 +1,13 @@
|
||||
*** Makefile.orig Tue May 27 09:50:36 1997
|
||||
--- Makefile Fri Jul 4 10:50:49 1997
|
||||
***************
|
||||
*** 4,11 ****
|
||||
DEBUG = -O2 -m486 -fno-strength-reduce -Wall -Wformat -Wstrict-prototypes -Wmissing-prototypes
|
||||
CFLAGS = $(DEBUG)
|
||||
LIBS =
|
||||
! BINDIR = /usr/sbin
|
||||
! MANDIR = /usr/man
|
||||
VERSION = 1.0.2
|
||||
#
|
||||
# this is the directory where the news is stored.
|
||||
--- 4,11 ----
|
||||
DEBUG = -O2 -m486 -fno-strength-reduce -Wall -Wformat -Wstrict-prototypes -Wmissing-prototypes
|
||||
CFLAGS = $(DEBUG)
|
||||
LIBS =
|
||||
! BINDIR = $(PREFIX)/sbin
|
||||
! MANDIR = $(PREFIX)/man
|
||||
VERSION = 1.0.2
|
||||
#
|
||||
# this is the directory where the news is stored.
|
||||
***************
|
||||
*** 13,19 ****
|
||||
#
|
||||
# this is the directory where the configuration and group information is
|
||||
# kept. It should preferably not be on the same partition as spooldir
|
||||
! LIBDIR = /usr/lib/leafnode
|
||||
|
||||
all: nntpd fetch texpire
|
||||
|
||||
--- 13,19 ----
|
||||
#
|
||||
# this is the directory where the configuration and group information is
|
||||
# kept. It should preferably not be on the same partition as spooldir
|
||||
! LIBDIR = $(PREFIX)/lib/leafnode
|
||||
|
||||
all: nntpd fetch texpire
|
||||
|
||||
***************
|
||||
*** 41,54 ****
|
||||
cp texpire $(BINDIR)
|
||||
cp *.8 $(MANDIR)/man8
|
||||
-mkdir -p $(SPOOLDIR) $(LIBDIR)
|
||||
! -mkdir -p $(SPOOLDIR)/{message.id,interesting.groups,out.going}
|
||||
@echo This is actually quite fast, for _small_ servers.
|
||||
! mkdir -p /var/spool/news/message.id/{0,1,2,3,4,5,6,7,8,9}{0,12,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}
|
||||
! cp config.example /usr/lib/leafnode/config
|
||||
chown -R news.news $(LIBDIR) $(SPOOLDIR)
|
||||
chmod 2750 $(SPOOLDIR)
|
||||
! chmod 750 $(BINDIR)/{leafnode,fetch,texpire}
|
||||
! chown news.news $(BINDIR)/{leafnode,fetch,texpire}
|
||||
@echo edit /etc/inetd.conf to start $(BINDIR)/leafnode
|
||||
|
||||
dist:
|
||||
--- 41,54 ----
|
||||
cp texpire $(BINDIR)
|
||||
cp *.8 $(MANDIR)/man8
|
||||
-mkdir -p $(SPOOLDIR) $(LIBDIR)
|
||||
! -csh -c 'mkdir -p $(SPOOLDIR)/{message.id,interesting.groups,out.going}'
|
||||
@echo This is actually quite fast, for _small_ servers.
|
||||
! csh -c 'mkdir -p /var/spool/news/message.id/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}'
|
||||
! cp config.example $(LIBDIR)/config.example
|
||||
chown -R news.news $(LIBDIR) $(SPOOLDIR)
|
||||
chmod 2750 $(SPOOLDIR)
|
||||
! csh -c 'chmod 750 $(BINDIR)/{leafnode,fetch,texpire}'
|
||||
! csh -c 'chown news.news $(BINDIR)/{leafnode,fetch,texpire}'
|
||||
@echo edit /etc/inetd.conf to start $(BINDIR)/leafnode
|
||||
|
||||
dist:
|
||||
--- fetch.c.~1~ Sun Mar 1 09:32:00 1998
|
||||
+++ fetch.c Fri Jul 24 22:18:05 1998
|
||||
@@ -918,8 +918,8 @@
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
- setregid( pw->pw_gid, pw->pw_gid );
|
||||
- setreuid( pw->pw_uid, pw->pw_uid );
|
||||
+ setgid( pw->pw_gid );
|
||||
+ setuid( pw->pw_uid );
|
||||
|
||||
if ( getuid() != pw->pw_uid || getgid() != pw->pw_gid ) {
|
||||
fprintf( stderr, "%s: must be run as news or root\n", argv[0] );
|
||||
|
@ -1,11 +1,11 @@
|
||||
--- util.c.orig Tue Oct 29 20:26:36 1996
|
||||
+++ util.c Fri Dec 19 16:52:20 1997
|
||||
@@ -1331,7 +1331,7 @@
|
||||
error, getcwd( s, 1024 ) );
|
||||
--- checkgroups.c.~1~ Wed Jul 23 11:35:26 1997
|
||||
+++ checkgroups.c Fri Jul 24 22:20:15 1998
|
||||
@@ -72,7 +72,7 @@
|
||||
}
|
||||
|
||||
strcpy( newfile, ".overview.XXXXXX" );
|
||||
- if ( (wfd=open( mktemp(newfile), O_WRONLY|O_CREAT|O_EXCL, 0664 )) ) {
|
||||
+ if ( (wfd=open( mkstemp(newfile), O_WRONLY|O_CREAT|O_EXCL, 0664 )) ) {
|
||||
struct iovec oooh[UIO_MAXIOV];
|
||||
int vi, vc, va;
|
||||
setgid( pw->pw_gid );
|
||||
- setreuid( pw->pw_uid, pw->pw_uid );
|
||||
+ setuid( pw->pw_uid );
|
||||
|
||||
if ( getuid() != pw->pw_uid || getgid() != pw->pw_gid ) {
|
||||
fprintf( stderr, "%s: must be run as news or root\n", argv[0] );
|
||||
|
@ -1,11 +1,20 @@
|
||||
--- fetch.c.orig Sun Oct 27 19:34:06 1996
|
||||
+++ fetch.c Fri Dec 19 16:42:23 1997
|
||||
@@ -645,7 +645,7 @@
|
||||
struct newsgroup * g;
|
||||
--- texpire.c.orig Wed Jul 23 11:35:26 1997
|
||||
+++ texpire.c Fri Jul 24 22:38:02 1998
|
||||
@@ -59,7 +59,7 @@
|
||||
FILE * f;
|
||||
char *l, *group, *stime, *end;
|
||||
unsigned long i;
|
||||
- struct expire_entry *ent, *prev = NULL;
|
||||
+ struct expire_entry *ent = NULL, *prev = NULL;
|
||||
|
||||
sprintf(s, "%s/expireinfo", libdir);
|
||||
if ((f = fopen(s, "r"))) {
|
||||
@@ -493,7 +493,7 @@
|
||||
}
|
||||
|
||||
strcpy( newfile, ".supplement.XXXXX" );
|
||||
- o = fopen( mktemp( newfile ), "w" );
|
||||
+ o = fopen( mkstemp( newfile ), "w" );
|
||||
|
||||
sprintf( s, "%s/interesting.groups",
|
||||
spooldir );
|
||||
setgid( pw->pw_gid );
|
||||
- setreuid( pw->pw_uid, pw->pw_uid );
|
||||
+ setuid( pw->pw_uid );
|
||||
|
||||
if ( getuid() != pw->pw_uid || getgid() != pw->pw_gid ) {
|
||||
fprintf( stderr, "%s: must be run as news or root\n", argv[0] );
|
||||
|
@ -1,5 +1,4 @@
|
||||
Leafnode v1.0.2 is a simple NNTP server designed for small sites.
|
||||
It does NOT have NOV support.
|
||||
Leafnode is a simple NNTP server designed for small sites.
|
||||
|
||||
It "learns" which newsgroups should be downloaded based on what's
|
||||
accessed.
|
||||
|
@ -1,7 +1,32 @@
|
||||
@cwd /usr/local
|
||||
@name leafnode-1.4.7
|
||||
lib/leafnode/config.example
|
||||
lib/leafnode/README
|
||||
lib/leafnode/INSTALL
|
||||
man/man1/newsq.1
|
||||
man/man8/fetch.8
|
||||
man/man8/checkgroups.8
|
||||
man/man8/leafnode.8
|
||||
man/man8/texpire.8
|
||||
sbin/fetch
|
||||
sbin/leafnode
|
||||
sbin/fetch
|
||||
sbin/texpire
|
||||
sbin/checkgroups
|
||||
sbin/newsq
|
||||
sbin/texpire.cron
|
||||
@dirrm lib/leafnode
|
||||
@comment Lots of things to do by hand to install
|
||||
@exec echo ""
|
||||
@exec echo "*** edit /etc/inetd.conf to start %D/sbin/leafnode"
|
||||
@exec echo "*** Verify /etc/config -- a copy of which is saved"
|
||||
@exec echo "*** as %D/lib/leafnode/config.example. See"
|
||||
@exec echo "*** %D/lib/leafnode/README and"
|
||||
@exec echo "*** %D/lib/leafnode/INSTALL for more information"
|
||||
@exec echo ""
|
||||
@unexec echo ""
|
||||
@unexec echo "*** To completely remove this package you must issue the"
|
||||
@unexec echo "*** following commands as root. Be sure you want to do this."
|
||||
@unexec echo "*** rm -rf /etc/leafnode"
|
||||
@unexec echo "*** rm -rf /var/run/news"
|
||||
@unexec echo "*** rm -rf /var/spool/news"
|
||||
@unexec echo ""
|
||||
|
52
news/leafnode/scripts/pre-install
Normal file
52
news/leafnode/scripts/pre-install
Normal file
@ -0,0 +1,52 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
|
||||
eval '(exit $?0)' && eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
|
||||
& eval 'exec /usr/bin/perl -S $0 $argv:q'
|
||||
if 0;
|
||||
|
||||
if( $> ) {
|
||||
print "\nYou must be root to run this step!\n\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if( getpwnam( "news" ) ) {
|
||||
( $null, $null, $pgUID ) = getpwnam( "news" );
|
||||
} else {
|
||||
$pgUID = 75;
|
||||
while( getpwuid( $pgUID ) ) {
|
||||
$pgUID++;
|
||||
}
|
||||
}
|
||||
|
||||
if( getgrnam( "news" ) ) {
|
||||
( $null, $null, $pgGID ) = getgrnam( "news" );
|
||||
} else {
|
||||
$pgGID = 75;
|
||||
while( getgrgid( $pgGID ) ) {
|
||||
$pgGID++;
|
||||
}
|
||||
&append_file( "/etc/group", "news:*:$pgGID:" );
|
||||
}
|
||||
|
||||
print "news user using uid $pgUID\n";
|
||||
print "news user using gid $pgGID\n";
|
||||
|
||||
print( "/usr/bin/chpass -a \"news:*:$pgUID\:$pgGID\:\:\:\:news pseudo-user:/var/spool/news:/bin/sh\"" );
|
||||
system( "/usr/bin/chpass -a \"news:*:$pgUID\:$pgGID\:\:\:\:news pseudo-user:/var/spool/news:/bin/sh\"" );
|
||||
print( "\n" );
|
||||
|
||||
sub append_file {
|
||||
local($file,@list) = @_;
|
||||
local($LOCK_EX) = 2;
|
||||
local($LOCK_NB) = 4;
|
||||
local($LOCK_UN) = 8;
|
||||
|
||||
open(F, ">> $file") || die "$file: $!\n";
|
||||
while( ! flock( F, $LOCK_EX | $LOCK_NB ) ) {
|
||||
exit 1;
|
||||
}
|
||||
print F join( "\n", @list) . "\n";
|
||||
close F;
|
||||
flock( F, $LOCK_UN );
|
||||
}
|
Loading…
Reference in New Issue
Block a user