head 1.5; access; symbols OPENPKG_E1_MP_HEAD:1.4 OPENPKG_E1_MP:1.4 OPENPKG_E1_MP_2_STABLE:1.4 OPENPKG_E1_FP:1.4 OPENPKG_2_STABLE_MP:1.4 OPENPKG_2_STABLE_20061018:1.4 OPENPKG_2_STABLE_20060622:1.4 OPENPKG_2_STABLE:1.4.0.4 OPENPKG_2_STABLE_BP:1.4 OPENPKG_2_5_RELEASE:1.4 OPENPKG_2_5_SOLID:1.4.0.2 OPENPKG_2_5_SOLID_BP:1.4 OPENPKG_2_4_RELEASE:1.2 OPENPKG_2_4_SOLID:1.2.0.8 OPENPKG_2_4_SOLID_BP:1.2 OPENPKG_CW_FP:1.2 OPENPKG_2_3_RELEASE:1.2 OPENPKG_2_3_SOLID:1.2.0.6 OPENPKG_2_3_SOLID_BP:1.2 OPENPKG_2_2_RELEASE:1.2 OPENPKG_2_2_SOLID:1.2.0.4 OPENPKG_2_2_SOLID_BP:1.2 OPENPKG_2_1_RELEASE:1.2 OPENPKG_2_1_SOLID:1.2.0.2 OPENPKG_2_1_SOLID_BP:1.2 OPENPKG_2_0_RELEASE:1.1 OPENPKG_2_0_SOLID:1.1.0.4 OPENPKG_2_0_SOLID_BP:1.1 OPENPKG_1_3_RELEASE:1.1.2.1 OPENPKG_1_3_SOLID:1.1.2.1.0.2 OPENPKG_1_3_SOLID_BP:1.1.2.1 OPENPKG_1_STABLE:1.1.0.2 OPENPKG_1_STABLE_MP:1.1; locks; strict; comment @# @; 1.5 date 2007.10.23.08.05.13; author rse; state Exp; branches; next 1.4; commitid GqF9h2FiKaGvOGCs; 1.4 date 2005.09.26.15.03.58; author rse; state Exp; branches; next 1.3; 1.3 date 2005.07.03.18.14.30; author rse; state Exp; branches; next 1.2; 1.2 date 2004.06.21.16.01.17; author ms; state Exp; branches; next 1.1; 1.1 date 2003.07.23.12.25.25; author mlelstv; state Exp; branches 1.1.2.1; next ; 1.1.2.1 date 2003.07.24.20.50.24; author rse; state Exp; branches; next ; desc @@ 1.5 log @upgrading package: portfwd 0.28 -> 0.29 @ text @Index: getopt/getopt.c --- getopt/getopt.c.orig 2002-09-07 04:27:51 +0200 +++ getopt/getopt.c 2007-10-23 08:55:09 +0200 @@@@ -40,6 +40,7 @@@@ #endif #include +#include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Index: src/Makefile.in --- src/Makefile.in.orig 2005-05-30 04:13:28 +0200 +++ src/Makefile.in 2007-10-23 08:55:09 +0200 @@@@ -73,7 +73,7 @@@@ VERSION = @@VERSION@@ YACC = @@YACC@@ -CFLAGS = -Wall -ggdb -O3 -DPORTFWD_CONF=\"$(sysconfdir)/portfwd.cfg\" +CFLAGS = -DPORTFWD_CONF=\"$(sysconfdir)/portfwd.cfg\" CXXFLAGS = $(CFLAGS) INCLUDES = -I$(top_srcdir)/src Index: src/director.cc --- src/director.cc.orig 2005-05-30 04:13:28 +0200 +++ src/director.cc 2007-10-23 08:55:09 +0200 @@@@ -195,7 +195,7 @@@@ address.len = 0; address.addr = (char *) malloc(address_buf_size * sizeof(char *)); if (!address.addr) { - syslog(LOG_ERR, "director::director(): malloc(%d) failed", address_buf_size); + syslog(LOG_ERR, "director::director(): malloc(%ld) failed", address_buf_size); exit(1); } } @@@@ -352,7 +352,7 @@@@ */ if (addr_buf_len > address_buf_size) { - syslog(LOG_ERR, "Insufficient space in local buffer for address (local_buffer_size=%d < address_length=%d)", address_buf_size, addr_buf_len); + syslog(LOG_ERR, "Insufficient space in local buffer for address (local_buffer_size=%ld < address_length=%ld)", (long)address_buf_size, (long)addr_buf_len); return -1; } Index: src/portfwd.cc --- src/portfwd.cc.orig 2005-05-30 04:13:28 +0200 +++ src/portfwd.cc 2007-10-23 08:55:09 +0200 @@@@ -37,6 +37,8 @@@@ int on_the_fly_dns = 0; int foreground = 0; +int dmz = -1; +const char *pidfile = NULL; void usage(FILE *out) { @@@@ -52,7 +54,8 @@@@ " -f | --on-the-fly-dns\n" " -g | --foreground\n" - " -c | --config \n", + " -c | --config \n" + " -p | --pidfile \n", prog); } @@@@ -82,14 +85,16 @@@@ {"on-the-fly-dns", 0, 0, 'f'}, {"foreground", 0, 0, 'g'}, {"config", 1, 0, 'c'}, + {"pidfile", 1, 0, 'p'}, {0, 0, 0, 0} }; *config = 0; + pidfile = 0; for (;;) { - opt = getopt_long(argc, (char ** const) argv, "hvdtfgc:", long_options, &option_index); + opt = getopt_long(argc, (char ** const) argv, "hvdtfgc:p:", long_options, &option_index); if (opt == -1) break; @@@@ -125,6 +130,13 @@@@ } *config = optarg; break; + case 'p': + if (pidfile) { + fprintf(stderr, "%s: Pid-file redefinition: %s", me, optarg); + exit(1); + } + pidfile = optarg; + break; case '?': usage(stderr); exit(1); @@@@ -246,6 +258,9 @@@@ closelog(); + if (!dmz && pidfile) + unlink(pidfile); + exit(0); } @@@@ -291,7 +306,7 @@@@ * Go to background. */ if (!foreground) { - int dmz = daemonize(); + dmz = daemonize(pidfile); if (dmz) { syslog(LOG_ERR, "daemonize() failed: %d", dmz); exit(1); Index: src/portfwd.h --- src/portfwd.h.orig 2005-05-30 04:13:28 +0200 +++ src/portfwd.h 2007-10-23 08:55:09 +0200 @@@@ -18,6 +18,7 @@@@ extern int on_the_fly_dns; extern int foreground; +extern const char *pidfile; #endif /* PORTFWD_H */ Index: src/util.cc --- src/util.cc.orig 2005-05-30 04:13:28 +0200 +++ src/util.cc 2007-10-23 08:55:09 +0200 @@@@ -118,7 +118,7 @@@@ return 0; } -int daemonize() +int daemonize(const char *pidfile) { ONVERBOSE(syslog(LOG_INFO, "Daemonizing")); @@@@ -146,6 +146,20 @@@@ return -1; } + if (pidfile) { + int pidfd; + size_t n; + char buf[20]; + n = snprintf(buf,sizeof(buf),"%lu",(unsigned long)pid); + if (n < sizeof(buf)) { + pidfd = open(pidfile, O_CREAT|O_TRUNC|O_WRONLY, 0666); + if (pidfd != -1) { + write(pidfd,buf,n); + close(pidfd); + } + } + } + /* * Parent exits */ Index: src/util.h --- src/util.h.orig 2005-05-30 04:13:28 +0200 +++ src/util.h 2007-10-23 08:55:09 +0200 @@@@ -28,7 +28,7 @@@@ int cd_root(); int std_to_null(); -int daemonize(); +int daemonize(const char *pidfile); void socket_close(int fd); Index: src/util.hpp --- src/util.hpp.orig 2001-05-15 02:25:01 +0200 +++ src/util.hpp 2007-10-23 08:55:09 +0200 @@@@ -15,7 +15,7 @@@@ { sample = new T[size]; if (!sample) { - syslog(LOG_EMERG, "%s:%s (%d x %d)\n", "safe_new()", "could not allocate array", size, sizeof(T)); + syslog(LOG_EMERG, "%s:%s (%ld x %ld)\n", "safe_new()", "could not allocate array", (long)size, (long)sizeof(T)); exit(1); } Index: src/vector.hpp --- src/vector.hpp.orig 2005-06-28 23:46:27 +0200 +++ src/vector.hpp 2007-10-23 08:55:09 +0200 @@@@ -55,8 +55,6 @@@@ T *begin_ptr() const; T *past_end_ptr() const; static T *next_ptr(T *i); - - friend std::ostream& operator << (std::ostream& out, const vector& v); }; template @ 1.4 log @cleanup sources @ text @d3 1 a3 1 +++ getopt/getopt.c 2005-09-26 17:01:03 +0200 d14 1 a14 1 +++ src/Makefile.in 2005-09-26 17:02:12 +0200 d26 1 a26 1 +++ src/director.cc 2005-09-26 17:01:03 +0200 d47 1 a47 1 +++ src/portfwd.cc 2005-09-26 17:01:03 +0200 d120 1 a120 1 +++ src/portfwd.h 2005-09-26 17:01:03 +0200 a128 17 Index: src/proto_map.cc --- src/proto_map.cc.orig 2004-01-28 20:14:10 +0100 +++ src/proto_map.cc 2005-09-26 17:01:03 +0200 @@@@ -16,11 +16,11 @@@@ map_list = map_l; fragile = 0; /* false */ - ftp_actv = (int) actv; + ftp_actv = (actv != NULL); if (ftp_actv) actv_ip = *actv; - ftp_pasv = (int) pasv; + ftp_pasv = (pasv != NULL); if (ftp_pasv) pasv_ip = *pasv; d131 1 a131 1 +++ src/util.cc 2005-09-26 17:01:03 +0200 d164 1 a164 1 +++ src/util.h 2005-09-26 17:01:03 +0200 d176 1 a176 1 +++ src/util.hpp 2005-09-26 17:01:03 +0200 d188 1 a188 1 +++ src/vector.hpp 2005-09-26 17:01:03 +0200 @ 1.3 log @upgrading package: portfwd 0.27 -> 0.28 @ text @d1 44 d47 1 a47 1 +++ src/portfwd.cc 2005-07-03 20:10:59 +0200 d57 2 a58 1 @@@@ -53,6 +55,7 @@@@ d61 2 a62 1 " -c | --config \n", d120 1 a120 1 +++ src/portfwd.h 2005-07-03 20:10:59 +0200 d129 17 d148 1 a148 1 +++ src/util.cc 2005-07-03 20:10:59 +0200 d181 1 a181 1 +++ src/util.h 2005-07-03 20:10:59 +0200 d191 12 d205 1 a205 1 +++ src/vector.hpp 2005-07-03 20:11:34 +0200 @ 1.2 log @remove unused friend which is causing problems (and hope it is not needed by foreign classes) @ text @d1 4 a4 3 --- src/portfwd.cc.dist 2003-07-23 13:30:00.000000000 +0200 +++ src/portfwd.cc 2003-07-23 14:22:44.000000000 +0200 @@@@ -36,6 +36,8 @@@@ d13 1 a13 1 @@@@ -52,6 +54,7 @@@@ d21 1 a21 1 @@@@ -81,14 +84,16 @@@@ d39 1 a39 1 @@@@ -124,6 +129,13 @@@@ d53 1 a53 1 @@@@ -245,6 +257,9 @@@@ d63 1 a63 1 @@@@ -290,7 +305,7 @@@@ d72 4 a75 3 --- src/portfwd.h.dist 2003-07-23 13:32:46.000000000 +0200 +++ src/portfwd.h 2003-07-23 13:32:56.000000000 +0200 @@@@ -20,6 +20,7 @@@@ d83 4 a86 3 --- src/util.cc.dist 2003-07-23 13:40:04.000000000 +0200 +++ src/util.cc 2003-07-23 14:15:35.000000000 +0200 @@@@ -135,7 +135,7 @@@@ d95 1 a95 1 @@@@ -163,6 +163,20 @@@@ d116 5 a120 3 --- src/util.h.dist 2003-07-23 14:09:04.000000000 +0200 +++ src/util.h 2003-07-23 14:09:13.000000000 +0200 @@@@ -29,7 +29,7 @@@@ a121 1 void close_fds(int first_fd); d128 4 a131 3 --- src/vector.hpp.dist 2002-09-06 20:04:04.000000000 +0200 +++ src/vector.hpp 2004-06-21 17:57:30.000000000 +0200 @@@@ -51,8 +51,6 @@@@ d136 1 a136 1 - friend std::ostream& operator << (std::ostream& out, const vector& v); @ 1.1 log @%status and pidfile handling @ text @d124 11 @ 1.1.2.1 log @mass Merge-From-CURRENT (MFC) in preparation for OpenPKG 1.3 [class PLUS only] @ text @@