diff options
author | obrien <obrien@FreeBSD.org> | 2013-02-08 16:10:16 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2013-02-08 16:10:16 +0000 |
commit | 3028e3f8aba938dfd0bf9fda987b8a72140b8027 (patch) | |
tree | b2f038222ff8a70f687652441df00d2b564c8abe /libexec | |
parent | 952a6d5a7cd3d3f9007acfa06805262fc04a105f (diff) | |
parent | 1d08d5f677c1dfa810e381073590adbae19cc69f (diff) | |
download | FreeBSD-src-3028e3f8aba938dfd0bf9fda987b8a72140b8027.zip FreeBSD-src-3028e3f8aba938dfd0bf9fda987b8a72140b8027.tar.gz |
Sync with HEAD.
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/bootpd/rtmsg.c | 26 | ||||
-rw-r--r-- | libexec/rtld-elf/Makefile | 12 | ||||
-rw-r--r-- | libexec/rtld-elf/libmap.c | 2 | ||||
-rw-r--r-- | libexec/rtld-elf/rtld.c | 6 | ||||
-rw-r--r-- | libexec/tftpd/tftp-io.c | 13 | ||||
-rw-r--r-- | libexec/tftpd/tftp-options.c | 13 | ||||
-rw-r--r-- | libexec/tftpd/tftp-utils.h | 2 | ||||
-rw-r--r-- | libexec/tftpd/tftpd.c | 9 |
8 files changed, 41 insertions, 42 deletions
diff --git a/libexec/bootpd/rtmsg.c b/libexec/bootpd/rtmsg.c index 8b81dab..c075bc5 100644 --- a/libexec/bootpd/rtmsg.c +++ b/libexec/bootpd/rtmsg.c @@ -106,9 +106,9 @@ static void getsocket () { } static struct sockaddr_in so_mask = {8, 0, 0, { 0xffffffff}}; -static struct sockaddr_inarp blank_sin = {sizeof(blank_sin), AF_INET }, sin_m; +static struct sockaddr_in blank_sin = {sizeof(blank_sin), AF_INET }, sin_m; static struct sockaddr_dl blank_sdl = {sizeof(blank_sdl), AF_LINK }, sdl_m; -static int expire_time, flags, export_only, doing_proxy; +static int expire_time, flags, doing_proxy; static struct { struct rt_msghdr m_rtm; char m_space[512]; @@ -122,7 +122,7 @@ int bsd_arp_set(ia, eaddr, len) char *eaddr; int len; { - register struct sockaddr_inarp *sin = &sin_m; + register struct sockaddr_in *sin = &sin_m; register struct sockaddr_dl *sdl; register struct rt_msghdr *rtm = &(m_rtmsg.m_rtm); u_char *ea; @@ -137,7 +137,7 @@ int bsd_arp_set(ia, eaddr, len) ea = (u_char *)LLADDR(&sdl_m); bcopy(eaddr, ea, len); sdl_m.sdl_alen = len; - doing_proxy = flags = export_only = expire_time = 0; + doing_proxy = flags = expire_time = 0; /* make arp entry temporary */ clock_gettime(CLOCK_MONOTONIC, &tp); @@ -148,7 +148,7 @@ tryagain: report(LOG_WARNING, "rtmget: %s", strerror(errno)); return (1); } - sin = (struct sockaddr_inarp *)(rtm + 1); + sin = (struct sockaddr_in *)(rtm + 1); sdl = (struct sockaddr_dl *)(sin->sin_len + (char *)sin); if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) { if (sdl->sdl_family == AF_LINK && @@ -163,13 +163,6 @@ tryagain: inet_ntoa(sin->sin_addr)); return (1); } - if (sin_m.sin_other & SIN_PROXY) { - report(LOG_WARNING, - "set: proxy entry exists for non 802 device\n"); - return(1); - } - sin_m.sin_other = SIN_PROXY; - export_only = 1; goto tryagain; } overwrite: @@ -209,14 +202,9 @@ static int rtmsg(cmd) rtm->rtm_rmx.rmx_expire = expire_time; rtm->rtm_inits = RTV_EXPIRE; rtm->rtm_flags |= (RTF_HOST | RTF_STATIC | RTF_LLDATA); - sin_m.sin_other = 0; if (doing_proxy) { - if (export_only) - sin_m.sin_other = SIN_PROXY; - else { - rtm->rtm_addrs |= RTA_NETMASK; - rtm->rtm_flags &= ~RTF_HOST; - } + rtm->rtm_addrs |= RTA_NETMASK; + rtm->rtm_flags &= ~RTF_HOST; } /* FALLTHROUGH */ case RTM_GET: diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile index 80737e8..31cbfdd 100644 --- a/libexec/rtld-elf/Makefile +++ b/libexec/rtld-elf/Makefile @@ -42,6 +42,16 @@ LDFLAGS+= -shared -Wl,-Bsymbolic DPADD= ${LIBC_PIC} LDADD= -lc_pic +.if ${MACHINE_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no" +# Some of the required math functions (div & mod) are implemented in libgcc +# on ARM. The library also needs to be placed first to be correctly linked. +# As some of the functions are used before we have shared libraries. +DPADD+= ${LIBGCC} +LDADD+= -lgcc +.endif + + + .if ${MK_SYMVER} == "yes" LIBCDIR= ${TOPSRCDIR}/lib/libc VERSION_DEF= ${LIBCDIR}/Versions.def @@ -62,7 +72,7 @@ SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Symbol.map # Fixup the existing binary that's there so we can symlink over it. beforeinstall: .if exists(${DESTDIR}/usr/libexec/${PROG}) - -chflags noschg ${DESTDIR}/usr/libexec/${PROG} + -chflags -h noschg ${DESTDIR}/usr/libexec/${PROG} .endif .PATH: ${.CURDIR}/${RTLD_ARCH} diff --git a/libexec/rtld-elf/libmap.c b/libexec/rtld-elf/libmap.c index 1efc8bc..29dc538 100644 --- a/libexec/rtld-elf/libmap.c +++ b/libexec/rtld-elf/libmap.c @@ -121,7 +121,7 @@ lmc_parse_file(char *path) } } - fd = open(rpath, O_RDONLY); + fd = open(rpath, O_RDONLY | O_CLOEXEC); if (fd == -1) { dbg("lm_parse_file: open(\"%s\") failed, %s", rpath, rtld_strerror(errno)); diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 1a7010e..bb790dd 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1598,7 +1598,7 @@ gethints(bool nostdlib) /* Keep from trying again in case the hints file is bad. */ hints = ""; - if ((fd = open(ld_elf_hints_path, O_RDONLY)) == -1) + if ((fd = open(ld_elf_hints_path, O_RDONLY | O_CLOEXEC)) == -1) return (NULL); if (read(fd, &hdr, sizeof hdr) != sizeof hdr || hdr.magic != ELFHINTS_MAGIC || @@ -2046,13 +2046,13 @@ load_object(const char *name, int fd_u, const Obj_Entry *refobj, int flags) */ fd = -1; if (fd_u == -1) { - if ((fd = open(path, O_RDONLY)) == -1) { + if ((fd = open(path, O_RDONLY | O_CLOEXEC)) == -1) { _rtld_error("Cannot open \"%s\"", path); free(path); return (NULL); } } else { - fd = dup(fd_u); + fd = fcntl(fd_u, F_DUPFD_CLOEXEC, 0); if (fd == -1) { _rtld_error("Cannot dup fd"); free(path); diff --git a/libexec/tftpd/tftp-io.c b/libexec/tftpd/tftp-io.c index d5d7fc6..6dabf4f 100644 --- a/libexec/tftpd/tftp-io.c +++ b/libexec/tftpd/tftp-io.c @@ -87,14 +87,13 @@ errtomsg(int error) { static char ebuf[40]; struct errmsg *pe; - char buf[MAXPKTSIZE]; if (error == 0) return ("success"); for (pe = errmsgs; pe->e_code >= 0; pe++) if (pe->e_code == error) return (pe->e_msg); - snprintf(ebuf, sizeof(buf), "error %d", error); + snprintf(ebuf, sizeof(ebuf), "error %d", error); return (ebuf); } @@ -107,13 +106,13 @@ send_packet(int peer, uint16_t block, char *pkt, int size) for (i = 0; i < 12 ; i++) { DROPPACKETn("send_packet", 0); - if (sendto(peer, pkt, size, 0, - (struct sockaddr *)&peer_sock, peer_sock.ss_len) - == size) { + if (sendto(peer, pkt, size, 0, (struct sockaddr *)&peer_sock, + peer_sock.ss_len) == size) { if (i) tftp_log(LOG_ERR, "%s block %d, attempt %d successful", - block, i); + packettype(ntohs(((struct tftphdr *) + (pkt))->th_opcode)), block, i); return (0); } tftp_log(LOG_ERR, @@ -143,7 +142,7 @@ send_error(int peer, int error) char buf[MAXPKTSIZE]; if (debug&DEBUG_PACKETS) - tftp_log(LOG_DEBUG, "Sending ERROR %d: %s", error); + tftp_log(LOG_DEBUG, "Sending ERROR %d", error); DROPPACKET("send_error"); diff --git a/libexec/tftpd/tftp-options.c b/libexec/tftpd/tftp-options.c index d5b6386..f926f32 100644 --- a/libexec/tftpd/tftp-options.c +++ b/libexec/tftpd/tftp-options.c @@ -99,16 +99,17 @@ option_tsize(int peer __unused, struct tftphdr *tp __unused, int mode, int option_timeout(int peer) { + int to; if (options[OPT_TIMEOUT].o_request == NULL) return (0); - int to = atoi(options[OPT_TIMEOUT].o_request); + to = atoi(options[OPT_TIMEOUT].o_request); if (to < TIMEOUT_MIN || to > TIMEOUT_MAX) { tftp_log(acting_as_client ? LOG_ERR : LOG_WARNING, "Received bad value for timeout. " - "Should be between %d and %d, received %s", - TIMEOUT_MIN, TIMEOUT_MAX); + "Should be between %d and %d, received %d", + TIMEOUT_MIN, TIMEOUT_MAX, to); send_error(peer, EBADOP); if (acting_as_client) return (1); @@ -195,14 +196,14 @@ option_blksize(int peer) tftp_log(LOG_ERR, "Invalid blocksize (%d bytes), " "net.inet.udp.maxdgram sysctl limits it to " - "%d bytes.\n", size, maxdgram); + "%ld bytes.\n", size, maxdgram); send_error(peer, EBADOP); return (1); } else { tftp_log(LOG_WARNING, "Invalid blocksize (%d bytes), " "net.inet.udp.maxdgram sysctl limits it to " - "%d bytes.\n", size, maxdgram); + "%ld bytes.\n", size, maxdgram); size = maxdgram; /* No reason to return */ } @@ -257,7 +258,7 @@ option_blksize2(int peer __unused) } tftp_log(LOG_INFO, "Invalid blocksize2 (%d bytes), net.inet.udp.maxdgram " - "sysctl limits it to %d bytes.\n", size, maxdgram); + "sysctl limits it to %ld bytes.\n", size, maxdgram); size = sizes[i]; /* No need to return */ } diff --git a/libexec/tftpd/tftp-utils.h b/libexec/tftpd/tftp-utils.h index 0468612..c1becf3 100644 --- a/libexec/tftpd/tftp-utils.h +++ b/libexec/tftpd/tftp-utils.h @@ -106,7 +106,7 @@ const char *debug_show(int d); extern int tftp_logtostdout; void tftp_openlog(const char *ident, int logopt, int facility); void tftp_closelog(void); -void tftp_log(int priority, const char *message, ...); +void tftp_log(int priority, const char *message, ...) __printflike(2, 3); /* * Performance figures diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c index a0010b3..87f80f0 100644 --- a/libexec/tftpd/tftpd.c +++ b/libexec/tftpd/tftpd.c @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include <fcntl.h> #include <netdb.h> #include <pwd.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -799,8 +800,8 @@ tftp_xmitfile(int peer, const char *mode) tftp_send(peer, &block, &ts); read_close(); if (debug&DEBUG_SIMPLE) - tftp_log(LOG_INFO, "Sent %d bytes in %d seconds", - ts.amount, time(NULL) - now); + tftp_log(LOG_INFO, "Sent %jd bytes in %jd seconds", + (intmax_t)ts.amount, (intmax_t)time(NULL) - now); } static void @@ -832,8 +833,8 @@ tftp_recvfile(int peer, const char *mode) f = now2.tv_sec - now1.tv_sec + (now2.tv_usec - now1.tv_usec) / 100000.0; tftp_log(LOG_INFO, - "Download of %d bytes in %d blocks completed after %0.1f seconds\n", - ts.amount, block, f); + "Download of %jd bytes in %d blocks completed after %0.1f seconds\n", + (intmax_t)ts.amount, block, f); } return; |