Bug #1555 ยป 0001-Changes-to-dma-to-allow-for-compilation-on-Linux.patch
| libexec/dma/Makefile.linux | ||
|---|---|---|
|
CC=gcc
|
||
|
CFLAGS=
|
||
|
LDADD= -lssl -lcrypto
|
||
|
INSTALL=install -p
|
||
|
DESTDIR=
|
||
|
PREFIX=/usr
|
||
|
SBIN=${PREFIX}/sbin
|
||
|
CONFDIR=${PREFIX}/etc
|
||
|
MAN=${PREFIX}/share/man
|
||
|
all: dma
|
||
|
clean:
|
||
|
-rm .depend dma *.[do]
|
||
|
-rm aliases_parse.[ch] aliases_scan.c reallocf.c strlcpy.c
|
||
|
|
||
|
install: all
|
||
|
${INSTALL} -d ${DESTDIR}${SBIN} ${DESTDIR}${CONFDIR}
|
||
|
${INSTALL} -d ${DESTDIR}${MAN}/man8
|
||
|
${INSTALL} -m 0755 dma ${DESTDIR}${SBIN}
|
||
|
${INSTALL} -m 0644 dma.8 ${DESTDIR}${MAN}/man8/
|
||
|
aliases_parse.c: aliases_parse.y
|
||
|
byacc -d -o aliases_parse.c aliases_parse.y
|
||
|
aliases_scan.c: aliases_scan.l
|
||
|
lex -t aliases_scan.l > aliases_scan.c
|
||
|
dma: aliases_parse.c aliases_scan.c reallocf.c strlcpy.c
|
||
|
${CC} -DLINUX ${LDADD} -o dma *.c
|
||
|
reallocf.c:
|
||
|
ln -sf ../../lib/libc/stdlib/reallocf.c .
|
||
|
strlcpy.c:
|
||
|
ln -sf ../../lib/libc/string/strlcpy.c
|
||
| libexec/dma/dma.c | ||
|---|---|---|
|
exit(1);
|
||
|
}
|
||
|
if (gettimeofday(&now, NULL) == 0 &&
|
||
|
#ifndef LINUX
|
||
|
(now.tv_sec - st.st_mtimespec.tv_sec > MAX_TIMEOUT)) {
|
||
|
#else
|
||
|
((time_t)now.tv_sec - st.st_mtime > MAX_TIMEOUT)) {
|
||
|
#endif
|
||
|
asprintf(__DECONST(void *, &errmsg),
|
||
|
"Could not deliver for the last %d seconds. Giving up.",
|
||
|
MAX_TIMEOUT);
|
||
| libexec/dma/dma.h | ||
|---|---|---|
|
#endif /* __GNUC__ */
|
||
|
#endif
|
||
|
#ifdef LINUX
|
||
|
#ifndef __DECONST
|
||
|
#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
|
||
|
#endif
|
||
|
#define getprogname() "dma"
|
||
|
#endif
|
||
|
#define VERSION "DragonFly Mail Agent"
|
||
|
#define BUF_SIZE 2048
|
||
| libexec/dma/dns.c | ||
|---|---|---|
|
p->ai.ai_addr = NULL;
|
||
|
bcopy(res->ai_addr, &p->sa, p->ai.ai_addrlen);
|
||
|
getnameinfo((struct sockaddr *)&p->sa, p->sa.ss_len,
|
||
|
getnameinfo((struct sockaddr *)&p->sa, sizeof(p->sa),
|
||
|
p->addr, sizeof(p->addr),
|
||
|
NULL, 0, NI_NUMERICHOST);
|
||
| libexec/dma/net.c | ||
|---|---|---|
|
return (-1);
|
||
|
}
|
||
|
if (connect(fd, (struct sockaddr *)&h->sa, h->sa.ss_len) < 0) {
|
||
|
if (connect(fd, (struct sockaddr *)&h->sa, sizeof(h->sa)) < 0) {
|
||
|
syslog(LOG_INFO, "connect to %s [%s] failed: %m",
|
||
|
h->host, h->addr);
|
||
|
close(fd);
|
||