mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-21 08:42:23 +00:00
Fix build with -fno-common
While here simplify the port's Makefile and fix the wrong usage of bzero and other library functions that take a buffer size: The size parameter passed was always the pointer, not the buffer pointed to, i.e. "bzero(buf, sizeof(buf)" instead of "bzero(buf, sizeof(*buf)" ...
This commit is contained in:
parent
65114dbd39
commit
e3f400194b
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=547533
@ -3,21 +3,20 @@
|
||||
|
||||
PORTNAME= monitord
|
||||
PORTVERSION= 0.4.1
|
||||
PORTREVISION= 4
|
||||
PORTREVISION= 5
|
||||
CATEGORIES= sysutils
|
||||
MASTER_SITES= http://lissyara.su/distfiles/
|
||||
|
||||
MAINTAINER= ports@FreeBSD.org
|
||||
COMMENT= Service that restarts other standalone services
|
||||
|
||||
LICENSE= BSD4CLAUSE
|
||||
LICENSE_FILE= ${WRKSRC}/COPYRIGHT
|
||||
|
||||
USE_RC_SUBR= monitord
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} -e 's|syslodg|syslogd|' ${WRKSRC}/${PORTNAME}.8
|
||||
@${REINPLACE_CMD} -e 's|-pipe||' ${WRKSRC}/Makefile
|
||||
|
||||
post-install:
|
||||
@${INSTALL_DATA} ${WRKSRC}/monitord.conf.sample \
|
||||
${INSTALL_DATA} ${WRKSRC}/monitord.conf.sample \
|
||||
${STAGEDIR}${PREFIX}/etc/monitord.conf.sample
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- Makefile.orig 2003-08-22 06:36:42.000000000 +0800
|
||||
+++ Makefile 2013-11-15 23:14:43.000000000 +0800
|
||||
@@ -6,7 +6,7 @@ OBJECTS = monitord.o mail.o
|
||||
--- Makefile.orig 2003-08-21 22:36:42 UTC
|
||||
+++ Makefile
|
||||
@@ -6,14 +6,14 @@ OBJECTS = monitord.o mail.o
|
||||
|
||||
TARGET = monitord
|
||||
|
||||
@ -9,6 +9,14 @@
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o
|
||||
|
||||
.c.o:
|
||||
|
||||
- $(CC) $(CFLAGS) -c -pipe -Wall $<
|
||||
+ $(CC) $(CFLAGS) -c -Wall $<
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(CC) $(OBJECTS) -o $(TARGET)
|
||||
@@ -24,10 +24,8 @@ clean:
|
||||
|
||||
all: $(TARGET)
|
||||
|
@ -1,6 +1,23 @@
|
||||
--- ./mail.c.orig Thu Aug 21 15:44:20 2003
|
||||
+++ ./mail.c Wed Mar 15 11:09:01 2006
|
||||
@@ -81,13 +81,13 @@
|
||||
--- mail.c.orig 2003-08-21 18:44:20 UTC
|
||||
+++ mail.c
|
||||
@@ -47,11 +47,11 @@ int mail ( char *address, char *eserver, char *subject
|
||||
username = (char *) malloc ( (size_t) _BUFSIZE ); // init the username buffer
|
||||
hostname = (char *) malloc ( (size_t) _BUFSIZE ); // init the hostname buffer
|
||||
thisname = (char *) malloc ( (size_t) _BUFSIZE ); // init the hostname buffer
|
||||
- bzero (buf, sizeof (buf) );
|
||||
- bzero (token, sizeof (token) );
|
||||
- bzero (username, sizeof (username) );
|
||||
- bzero (hostname, sizeof (hostname) );
|
||||
- bzero (thisname, sizeof (thisname) );
|
||||
+ bzero (buf, sizeof (*buf) );
|
||||
+ bzero (token, sizeof (*token) );
|
||||
+ bzero (username, sizeof (*username) );
|
||||
+ bzero (hostname, sizeof (*hostname) );
|
||||
+ bzero (thisname, sizeof (*thisname) );
|
||||
|
||||
strncpy (buf, address, _BUFSIZE);
|
||||
username = strtok (buf, "@");
|
||||
@@ -81,13 +81,13 @@ int mail ( char *address, char *eserver, char *subject
|
||||
read (serversd, buf, _BUFSIZE);
|
||||
|
||||
// Set "MAIL FROM"
|
||||
@ -16,7 +33,7 @@
|
||||
write(serversd, buf, strlen(buf));
|
||||
read (serversd, buf, _BUFSIZE);
|
||||
|
||||
@@ -97,17 +97,17 @@
|
||||
@@ -97,17 +97,17 @@ int mail ( char *address, char *eserver, char *subject
|
||||
read (serversd, buf, _BUFSIZE);
|
||||
|
||||
// Set "FROM"
|
||||
|
11
sysutils/monitord/files/patch-monitord.8
Normal file
11
sysutils/monitord/files/patch-monitord.8
Normal file
@ -0,0 +1,11 @@
|
||||
--- monitord.8.orig 2003-08-21 20:53:45 UTC
|
||||
+++ monitord.8
|
||||
@@ -128,7 +128,7 @@ Here are a few more example service entries:
|
||||
.Pp
|
||||
.Bd -literal
|
||||
root auto,alert 30 syslogd /usr/sbin/inetd -wW
|
||||
-root auto,alert 30 syslodg /usr/sbin/syslogd
|
||||
+root auto,alert 30 syslogd /usr/sbin/syslogd
|
||||
www auto,alert 60 httpd /usr/local/etc/rc.d/apache.sh
|
||||
.Ed
|
||||
.Pp
|
@ -1,6 +1,24 @@
|
||||
--- monitord.c.orig 2003-01-16 21:39:44.000000000 +0000
|
||||
+++ monitord.c 2011-11-24 23:12:13.468148722 +0000
|
||||
@@ -85,8 +85,8 @@
|
||||
--- monitord.c.orig 2003-01-16 21:39:44 UTC
|
||||
+++ monitord.c
|
||||
@@ -30,6 +30,8 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
#include "monitord.h"
|
||||
#include "config.h"
|
||||
|
||||
+static int HUP;
|
||||
+
|
||||
int main (int argc, char *arga[]) {
|
||||
|
||||
int i, num, interval;
|
||||
@@ -69,7 +71,7 @@ int main (int argc, char *arga[]) {
|
||||
// init the *file[];
|
||||
for ( i = 0; i < _MAXLINE; i++ ) {
|
||||
file[i] = (char *) malloc ( (size_t) sizeof(char) * _BUFSIZE );
|
||||
- bzero ( file[i], sizeof (file[i]) );
|
||||
+ bzero ( file[i], sizeof (*file[i]) );
|
||||
}
|
||||
|
||||
// file = (char **) calloc (1000, (size_t) sizeof(char) * _BUFSIZE );
|
||||
@@ -85,8 +87,8 @@ int main (int argc, char *arga[]) {
|
||||
setsid ();
|
||||
break;
|
||||
}
|
||||
@ -11,7 +29,87 @@
|
||||
}
|
||||
|
||||
/* Read the configuration file, saving it in *file[] and return the number of lines
|
||||
@@ -454,13 +454,13 @@
|
||||
@@ -119,7 +121,7 @@ int read_conf ( char ***file, char *filename ) {
|
||||
char *buf;
|
||||
|
||||
buf = (char *) malloc ( (size_t) _BUFSIZE ); // init & zero the buffer
|
||||
- bzero (buf, sizeof (buf) );
|
||||
+ bzero (buf, sizeof (*buf) );
|
||||
|
||||
line_count = 0;
|
||||
|
||||
@@ -146,7 +148,7 @@ int read_conf ( char ***file, char *filename ) {
|
||||
strncpy ( (char *) file[line_count], buf, _BUFSIZE );
|
||||
// realloc ( & file[1], (size_t) sizeof(char) * _BUFSIZE * (line_count + 1) );
|
||||
// zero out the buffer so we don't have it hold old garbage
|
||||
- bzero (buf, sizeof (buf));
|
||||
+ bzero (buf, sizeof (*buf));
|
||||
|
||||
line_count++; // Advance the counter
|
||||
|
||||
@@ -197,9 +199,9 @@ int loop ( char **file, char *filename, int max_proc,
|
||||
buf = (char *) malloc ( (size_t) _BUFSIZE ); // init the all purpose buffer
|
||||
buf2 = (char *) malloc ( (size_t) _BUFSIZE ); // init another all purpose buffer
|
||||
token = (char *) malloc ( (size_t) _BUFSIZE ); // init the token buffer
|
||||
- bzero (buf, sizeof (buf) );
|
||||
- bzero (buf2, sizeof (buf) );
|
||||
- bzero (token, sizeof (token) );
|
||||
+ bzero (buf, sizeof (*buf) );
|
||||
+ bzero (buf2, sizeof (*buf) );
|
||||
+ bzero (token, sizeof (*token) );
|
||||
|
||||
FOUND = 0;
|
||||
|
||||
@@ -290,8 +292,8 @@ int loop ( char **file, char *filename, int max_proc,
|
||||
|
||||
bzero (param, sizeof(param));
|
||||
while ((token = strtok(NULL, " \t"))) {
|
||||
- strncat (param, " ", sizeof(param));
|
||||
- strncat (param, token, sizeof(param));
|
||||
+ strncat (param, " ", sizeof(*param));
|
||||
+ strncat (param, token, sizeof(*param));
|
||||
}
|
||||
|
||||
/* Each line has a \n at the end which must be removed
|
||||
@@ -355,7 +357,7 @@ int loop ( char **file, char *filename, int max_proc,
|
||||
// printf("Couldn't open %s\n", buf);
|
||||
}
|
||||
// Set the FOUND flag if the process we're checking for is found
|
||||
- if (!strncmp (buf, proc, sizeof(buf))) FOUND = TRUE;
|
||||
+ if (!strncmp (buf, proc, sizeof(*buf))) FOUND = TRUE;
|
||||
}
|
||||
closedir (dirp); // Close the /proc directory
|
||||
|
||||
@@ -365,8 +367,8 @@ int loop ( char **file, char *filename, int max_proc,
|
||||
/* Email admin that the service has died, if the "mail"
|
||||
option has been set in the options */
|
||||
if (options.alert) {
|
||||
- bzero (buf, sizeof(buf));
|
||||
- bzero (buf2, sizeof(buf2));
|
||||
+ bzero (buf, sizeof(*buf));
|
||||
+ bzero (buf2, sizeof(*buf2));
|
||||
sprintf (buf, "[%s] Service \"%s\" has died\n", getdate(), proc);
|
||||
sprintf (buf2, "(monitord) SYSTEM ALERT, \"%s\" has died\n", proc);
|
||||
mail (email, eserver, buf2, buf);
|
||||
@@ -405,7 +407,7 @@ int loop ( char **file, char *filename, int max_proc,
|
||||
/* Email the admin that the service has been
|
||||
restarted if "mail" option is set */
|
||||
if (options.alert) {
|
||||
- bzero (buf, sizeof(buf));
|
||||
+ bzero (buf, sizeof(*buf));
|
||||
sprintf (buf, "[%s] restarted \"%s\" using \"%s %s\"\n", getdate(), proc, script_path, param);
|
||||
sprintf (buf2, "(monitord) \"%s\" restarted\n", proc);
|
||||
mail (email, eserver, buf2, buf);
|
||||
@@ -418,7 +420,7 @@ int loop ( char **file, char *filename, int max_proc,
|
||||
been able to be restarted if "mail" option
|
||||
is set */
|
||||
if (options.alert) {
|
||||
- bzero (buf, sizeof(buf));
|
||||
+ bzero (buf, sizeof(*buf));
|
||||
sprintf (buf, "[%s] unable to restart \"%s\"\n", getdate(), proc);
|
||||
sprintf (buf2, "(monitord) SYSTEM ALERT: \"%s\" unable to restart\n", proc);
|
||||
mail (email, eserver, buf2, buf);
|
||||
@@ -454,13 +456,13 @@ char *getdate () {
|
||||
|
||||
struct timeval *tp;
|
||||
struct timezone *tzp;
|
||||
|
11
sysutils/monitord/files/patch-monitord.h
Normal file
11
sysutils/monitord/files/patch-monitord.h
Normal file
@ -0,0 +1,11 @@
|
||||
--- monitord.h.orig 2003-01-16 18:22:54 UTC
|
||||
+++ monitord.h
|
||||
@@ -49,8 +49,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
-int HUP; // Variable used to hold SIGHUP state
|
||||
-
|
||||
typedef enum bool_enum_t {
|
||||
FALSE,
|
||||
TRUE,
|
Loading…
Reference in New Issue
Block a user