0001-Changes-to-dma-to-allow-for-compilation-on-Linux.patch

msylvan, 10/03/2009 05:00 PM

Download (3.33 KB)

View differences:

libexec/dma/Makefile.linux
1
CC=gcc
2
CFLAGS=
3
LDADD= -lssl -lcrypto
4

  
5
INSTALL=install -p
6
DESTDIR=
7
PREFIX=/usr
8
SBIN=${PREFIX}/sbin
9
CONFDIR=${PREFIX}/etc
10
MAN=${PREFIX}/share/man
11

  
12
all: dma
13

  
14
clean:
15
	-rm .depend dma *.[do]
16
	-rm aliases_parse.[ch] aliases_scan.c reallocf.c strlcpy.c
17
 
18
install: all
19
	${INSTALL} -d ${DESTDIR}${SBIN} ${DESTDIR}${CONFDIR}
20
	${INSTALL} -d ${DESTDIR}${MAN}/man8
21
	${INSTALL} -m 0755 dma ${DESTDIR}${SBIN}
22
	${INSTALL} -m 0644 dma.8 ${DESTDIR}${MAN}/man8/
23

  
24
aliases_parse.c: aliases_parse.y
25
	byacc -d -o aliases_parse.c aliases_parse.y
26

  
27
aliases_scan.c: aliases_scan.l
28
	lex -t aliases_scan.l > aliases_scan.c
29

  
30
dma: aliases_parse.c aliases_scan.c reallocf.c strlcpy.c
31
	${CC} -DLINUX ${LDADD} -o dma *.c
32

  
33
reallocf.c:
34
	ln -sf ../../lib/libc/stdlib/reallocf.c .
35

  
36
strlcpy.c:
37
	ln -sf ../../lib/libc/string/strlcpy.c
libexec/dma/dma.c
295 295
			exit(1);
296 296
		}
297 297
		if (gettimeofday(&now, NULL) == 0 &&
298
#ifndef LINUX
298 299
		    (now.tv_sec - st.st_mtimespec.tv_sec > MAX_TIMEOUT)) {
300
#else
301
		    ((time_t)now.tv_sec - st.st_mtime > MAX_TIMEOUT)) {
302
#endif
299 303
			asprintf(__DECONST(void *, &errmsg),
300 304
				 "Could not deliver for the last %d seconds. Giving up.",
301 305
				 MAX_TIMEOUT);
libexec/dma/dma.h
52 52
#endif  /* __GNUC__ */
53 53
#endif
54 54

  
55
#ifdef LINUX
56
#ifndef __DECONST
57
#define __DECONST(type, var)    ((type)(uintptr_t)(const void *)(var))
58
#endif
59

  
60
#define getprogname() "dma"
61
#endif
62

  
55 63
#define VERSION	"DragonFly Mail Agent"
56 64

  
57 65
#define BUF_SIZE	2048
libexec/dma/dns.c
97 97
		p->ai.ai_addr = NULL;
98 98
		bcopy(res->ai_addr, &p->sa, p->ai.ai_addrlen);
99 99

  
100
		getnameinfo((struct sockaddr *)&p->sa, p->sa.ss_len,
100
		getnameinfo((struct sockaddr *)&p->sa, sizeof(p->sa),
101 101
			    p->addr, sizeof(p->addr),
102 102
			    NULL, 0, NI_NUMERICHOST);
103 103

  
libexec/dma/net.c
290 290
		return (-1);
291 291
	}
292 292

  
293
	if (connect(fd, (struct sockaddr *)&h->sa, h->sa.ss_len) < 0) {
293
	if (connect(fd, (struct sockaddr *)&h->sa, sizeof(h->sa)) < 0) {
294 294
		syslog(LOG_INFO, "connect to %s [%s] failed: %m",
295 295
		       h->host, h->addr);
296 296
		close(fd);
297
-