diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bhyve/rfb.c | 16 | ||||
-rw-r--r-- | usr.sbin/bsdinstall/partedit/partedit_arm64.c | 6 | ||||
-rw-r--r-- | usr.sbin/bsdinstall/partedit/partedit_x86.c | 8 | ||||
-rwxr-xr-x | usr.sbin/bsdinstall/scripts/auto | 2 | ||||
-rwxr-xr-x | usr.sbin/bsdinstall/scripts/zfsboot | 8 | ||||
-rw-r--r-- | usr.sbin/chown/tests/Makefile | 6 | ||||
-rwxr-xr-x | usr.sbin/chown/tests/chown-f_test.sh | 21 | ||||
-rwxr-xr-x | usr.sbin/chown/tests/chown_test.sh | 206 | ||||
-rw-r--r-- | usr.sbin/freebsd-update/freebsd-update.8 | 12 | ||||
-rw-r--r-- | usr.sbin/ifmcstat/ifmcstat.c | 12 | ||||
-rw-r--r-- | usr.sbin/ip6addrctl/ip6addrctl.c | 4 | ||||
-rw-r--r-- | usr.sbin/lpr/lpc/lpc.c | 2 | ||||
-rw-r--r-- | usr.sbin/makefs/mtree.c | 6 | ||||
-rw-r--r-- | usr.sbin/rpc.lockd/lockd.c | 7 |
14 files changed, 255 insertions, 61 deletions
diff --git a/usr.sbin/bhyve/rfb.c b/usr.sbin/bhyve/rfb.c index f6acc580aa0a..0f492e1b9d48 100644 --- a/usr.sbin/bhyve/rfb.c +++ b/usr.sbin/bhyve/rfb.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #ifndef WITHOUT_CAPSICUM #include <sys/capsicum.h> #endif +#include <sys/endian.h> #include <sys/socket.h> #include <sys/select.h> #include <sys/time.h> @@ -754,7 +755,7 @@ rfb_handle(struct rfb_softc *rc, int cfd) { const char *vbuf = "RFB 003.008\n"; unsigned char buf[80]; - unsigned char *message; + unsigned char *message = NULL; #ifndef NO_OPENSSL unsigned char challenge[AUTH_LENGTH]; @@ -766,8 +767,9 @@ rfb_handle(struct rfb_softc *rc, int cfd) #endif pthread_t tid; - uint32_t sres; + uint32_t sres = 0; int len; + int perror = 1; rc->cfd = cfd; @@ -858,7 +860,7 @@ rfb_handle(struct rfb_softc *rc, int cfd) stream_write(cfd, &sres, 4); if (sres) { - *((uint32_t *) buf) = htonl(strlen(message)); + be32enc(buf, strlen(message)); stream_write(cfd, buf, 4); stream_write(cfd, message, strlen(message)); goto done; @@ -877,8 +879,9 @@ rfb_handle(struct rfb_softc *rc, int cfd) rfb_send_screen(rc, cfd, 1); - pthread_create(&tid, NULL, rfb_wr_thr, rc); - pthread_set_name_np(tid, "rfbout"); + perror = pthread_create(&tid, NULL, rfb_wr_thr, rc); + if (perror == 0) + pthread_set_name_np(tid, "rfbout"); /* Now read in client requests. 1st byte identifies type */ for (;;) { @@ -914,7 +917,8 @@ rfb_handle(struct rfb_softc *rc, int cfd) } done: rc->cfd = -1; - pthread_join(tid, NULL); + if (perror == 0) + pthread_join(tid, NULL); if (rc->enc_zlib_ok) deflateEnd(&rc->zstream); } diff --git a/usr.sbin/bsdinstall/partedit/partedit_arm64.c b/usr.sbin/bsdinstall/partedit/partedit_arm64.c index 5c0fb0309cd6..7fe784d5c6d1 100644 --- a/usr.sbin/bsdinstall/partedit/partedit_arm64.c +++ b/usr.sbin/bsdinstall/partedit/partedit_arm64.c @@ -34,8 +34,8 @@ #include "partedit.h" -/* EFI partition size in KB */ -#define EFI_BOOTPART_SIZE (50 * 1024) +/* EFI partition size in bytes */ +#define EFI_BOOTPART_SIZE (200 * 1024 * 1024) #define EFI_BOOTPART_PATH "/boot/boot1.efifat" const char * @@ -73,7 +73,7 @@ bootpart_size(const char *scheme) if (strcmp(scheme, "GPT") != 0) return (0); - return ((EFI_BOOTPART_SIZE) * 1024); + return (EFI_BOOTPART_SIZE); } const char * diff --git a/usr.sbin/bsdinstall/partedit/partedit_x86.c b/usr.sbin/bsdinstall/partedit/partedit_x86.c index 5616e580fe47..a5f65ba4c759 100644 --- a/usr.sbin/bsdinstall/partedit/partedit_x86.c +++ b/usr.sbin/bsdinstall/partedit/partedit_x86.c @@ -32,6 +32,10 @@ #include "partedit.h" +/* EFI partition size in bytes */ +#define EFI_BOOTPART_SIZE (200 * 1024 * 1024) +#define EFI_BOOTPART_PATH "/boot/boot1.efifat" + static const char * x86_bootmethod(void) { @@ -99,7 +103,7 @@ bootpart_size(const char *scheme) if (strcmp(x86_bootmethod(), "BIOS") == 0) return (512*1024); else - return (200*1024*1024); + return (EFI_BOOTPART_SIZE); return (0); } @@ -137,7 +141,7 @@ partcode_path(const char *part_type, const char *fs_type) if (strcmp(part_type, "GPT") == 0) { if (strcmp(x86_bootmethod(), "UEFI") == 0) - return ("/boot/boot1.efifat"); + return (EFI_BOOTPART_PATH); else if (strcmp(fs_type, "zfs") == 0) return ("/boot/gptzfsboot"); else diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index 254daa23280e..42b7422a6cac 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -260,7 +260,7 @@ Shell \"Open a shell and partition by hand\"" CURARCH=$( uname -m ) case $CURARCH in - amd64|i386) # Booting ZFS Supported + amd64|arm64|i386) # Booting ZFS Supported PMODES="$PMODES \"Auto (ZFS)\" \"Guided Root-on-ZFS\"" ;; *) # Booting ZFS Unspported diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot index 9fbf5c9929d2..36b136c54aee 100755 --- a/usr.sbin/bsdinstall/scripts/zfsboot +++ b/usr.sbin/bsdinstall/scripts/zfsboot @@ -848,7 +848,7 @@ zfs_create_diskpart() f_eval_catch $funcname gpart \ "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \ - "$align_small" efiboot$index efi 800k $disk || + "$align_small" efiboot$index efi 200M $disk || return $FAILURE f_eval_catch $funcname gpart "$GPART_BOOTCODE_PARTONLY" \ /boot/boot1.efifat 1 $disk || @@ -1443,6 +1443,12 @@ zfs_create_boot() 'kern.geom.label.gptid.enable=\"0\"' \ $BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE + if [ "$ZFSBOOT_FORCE_4K_SECTORS" ]; then + f_eval_catch $funcname echo "$ECHO_APPEND" \ + 'vfs.zfs.min_auto_ashift=12' \ + $BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE + fi + if [ "$ZFSBOOT_SWAP_MIRROR" ]; then f_eval_catch $funcname echo "$ECHO_APPEND" \ 'geom_mirror_load=\"YES\"' \ diff --git a/usr.sbin/chown/tests/Makefile b/usr.sbin/chown/tests/Makefile index e627afc91810..506d81cbaa8b 100644 --- a/usr.sbin/chown/tests/Makefile +++ b/usr.sbin/chown/tests/Makefile @@ -1,9 +1,5 @@ # $FreeBSD$ -.include <bsd.own.mk> - -TESTSDIR= ${TESTSBASE}/usr.sbin/chown - -TAP_TESTS_SH= chown-f_test +ATF_TESTS_SH+= chown_test .include <bsd.test.mk> diff --git a/usr.sbin/chown/tests/chown-f_test.sh b/usr.sbin/chown/tests/chown-f_test.sh deleted file mode 100755 index c66b0085fc25..000000000000 --- a/usr.sbin/chown/tests/chown-f_test.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -base=`basename $0` - -echo "1..1" - -name="chown -f root:wheel file" -if [ `id -u` -eq 0 ]; then - echo "ok 1 - $name # skip Test must not be uid 0." -else - touch file - output=$(chown -f root:wheel file 2>&1) - if [ $? -eq 0 -a -z "$output" ] - then - echo "ok 1 - $name" - else - echo "not ok 1 - $name" - fi - rm file -fi diff --git a/usr.sbin/chown/tests/chown_test.sh b/usr.sbin/chown/tests/chown_test.sh new file mode 100755 index 000000000000..a5e55f9287e4 --- /dev/null +++ b/usr.sbin/chown/tests/chown_test.sh @@ -0,0 +1,206 @@ +# +# Copyright (c) 2017 Dell EMC +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +atf_test_case RH_flag +RH_flag_head() +{ + atf_set "descr" "Verify that setting ownership recursively via -R doesn't " \ + "affect symlinks specified via the arguments when -H " \ + "is specified" + atf_set "require.user" "root" +} +RH_flag_body() +{ + atf_check mkdir -p A/B + atf_check ln -s B A/C + atf_check chown -h 42:42 A/C + atf_check -o inline:'0:0\n0:0\n42:42\n' stat -f '%u:%g' A A/B A/C + atf_check chown -RH 84:84 A + atf_check -o inline:'84:84\n84:84\n84:84\n' stat -f '%u:%g' A A/B A/C + atf_check chown -RH 126:126 A/C + atf_check -o inline:'84:84\n126:126\n84:84\n' stat -f '%u:%g' A A/B A/C +} + +atf_test_case RL_flag +RL_flag_head() +{ + atf_set "descr" "Verify that setting ownership recursively via -R doesn't " \ + "affect symlinks specified via the arguments when -L " \ + "is specified" + atf_set "require.user" "root" +} +RL_flag_body() +{ + atf_check mkdir -p A/B + atf_check ln -s B A/C + atf_check chown -h 42:42 A/C + atf_check -o inline:'0:0\n0:0\n42:42\n' stat -f '%u:%g' A A/B A/C + atf_check chown -RL 84:84 A + atf_check -o inline:'84:84\n84:84\n42:42\n' stat -f '%u:%g' A A/B A/C + atf_check chown -RL 126:126 A/C + atf_check -o inline:'84:84\n126:126\n42:42\n' stat -f '%u:%g' A A/B A/C +} + +atf_test_case RP_flag +RP_flag_head() +{ + atf_set "descr" "Verify that setting ownership recursively via -R " \ + "doesn't affect symlinks specified via the arguments " \ + "when -P is specified" + atf_set "require.user" "root" +} +RP_flag_body() +{ + atf_check mkdir -p A/B + atf_check ln -s B A/C + atf_check chown -h 42:42 A/C + atf_check -o inline:'0:0\n0:0\n42:42\n' stat -f '%u:%g' A A/B A/C + atf_check chown -RP 84:84 A + atf_check -o inline:'84:84\n84:84\n84:84\n' stat -f '%u:%g' A A/B A/C + atf_check chown -RP 126:126 A/C + atf_check -o inline:'84:84\n84:84\n126:126\n' stat -f '%u:%g' A A/B A/C +} + +atf_test_case f_flag cleanup +f_flag_head() +{ + atf_set "descr" "Verify that setting a mode for a file with -f " \ + "doesn't emit an error message/exit with a non-zero " \ + "code" + atf_set "require.user" "root" +} + +f_flag_body() +{ + atf_check truncate -s 0 foo bar + atf_check chown 0:0 foo bar + atf_check chflags uchg foo + atf_check -e not-empty -s not-exit:0 chown 42:42 foo bar + atf_check -o inline:'0:0\n42:42\n' stat -f '%u:%g' foo bar + atf_check -s exit:0 chown -f 84:84 foo bar + atf_check -o inline:'0:0\n84:84\n' stat -f '%u:%g' foo bar +} + +f_flag_cleanup() +{ + atf_check chflags 0 foo +} + +atf_test_case h_flag +h_flag_head() +{ + atf_set "descr" "Verify that setting a mode for a file with -f " \ + "doesn't emit an error message/exit with a non-zero " \ + "code" + atf_set "require.user" "root" +} + +h_flag_body() +{ + atf_check truncate -s 0 foo + atf_check -o inline:'0:0\n' stat -f '%u:%g' foo + atf_check ln -s foo bar + atf_check -o inline:'0:0\n0:0\n' stat -f '%u:%g' foo bar + atf_check chown -h 42:42 bar + atf_check -o inline:'0:0\n42:42\n' stat -f '%u:%g' foo bar + atf_check chown 84:84 bar + atf_check -o inline:'84:84\n42:42\n' stat -f '%u:%g' foo bar +} + +atf_test_case v_flag +v_flag_head() +{ + atf_set "descr" "Verify that setting ownership with -v emits the " \ + "file doesn't emit an error message/exit with a " \ + "non-zero code" + atf_set "require.user" "root" +} +v_flag_body() +{ + atf_check truncate -s 0 foo bar + atf_check chown 0:0 foo + atf_check chown 42:42 bar + atf_check -o 'inline:bar\n' chown -v 0:0 foo bar + atf_check chown -v 0:0 foo bar + for f in foo bar; do + echo "$f: 0:0 -> 84:84"; + done > output.txt + atf_check -o file:output.txt chown -vv 84:84 foo bar + atf_check chown -vv 84:84 foo bar +} + +md_file="md.out" +atf_test_case x_flag cleanup +x_flag_head() +{ + atf_set "descr" "Verify that setting a mode with -x doesn't set " \ + "ownership across mountpoints" + atf_set "require.user" "root" +} +x_flag_body() +{ + atf_check -o save:$md_file mdconfig -a -t malloc -s 20m + if ! md_device=$(cat $md_file); then + atf_fail "cat $md_file failed" + fi + atf_check -o not-empty newfs /dev/$md_device + atf_check mkdir mnt + atf_check mount /dev/$md_device mnt + atf_check truncate -s 0 foo bar mnt/bazbaz + atf_check ln -s bar mnt/barbaz + atf_check ln -s ../foo mnt/foobaz + cd mnt + test_files="../foo ../bar barbaz bazbaz foobaz" + atf_check -o inline:'0:0\n0:0\n0:0\n0:0\n0:0\n' \ + stat -f '%u:%g' $test_files + atf_check chown -Rx 42:42 . + atf_check -o inline:'0:0\n0:0\n42:42\n42:42\n42:42\n' \ + stat -f '%u:%g' $test_files + atf_check chown -R 84:84 . + atf_check -o inline:'0:0\n0:0\n84:84\n84:84\n84:84\n' \ + stat -f '%u:%g' $test_files +} +x_flag_cleanup() +{ + if ! md_device=$(cat $md_file) || [ -z "$md_device" ]; then + echo "Couldn't get device from $md_file" + exit 0 + fi + umount mnt + mdconfig -d -u $md_device +} + +atf_init_test_cases() +{ + atf_add_test_case RH_flag + atf_add_test_case RL_flag + atf_add_test_case RP_flag + atf_add_test_case f_flag + atf_add_test_case h_flag + atf_add_test_case v_flag + atf_add_test_case x_flag +} diff --git a/usr.sbin/freebsd-update/freebsd-update.8 b/usr.sbin/freebsd-update/freebsd-update.8 index c0c9ae05ae7d..ec9eb9519e03 100644 --- a/usr.sbin/freebsd-update/freebsd-update.8 +++ b/usr.sbin/freebsd-update/freebsd-update.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 2, 2015 +.Dd June 14, 2017 .Dt FREEBSD-UPDATE 8 .Os FreeBSD .Sh NAME @@ -56,13 +56,13 @@ by the .Fx Release Engineering Team, e.g., .Fx -9.3-RELEASE and +10.3-RELEASE and .Fx -10.1-RELEASE, but not +11.0-RELEASE, but not .Fx -9.3-STABLE or +10.3-STABLE or .Fx -11-CURRENT. +12-CURRENT. .Sh OPTIONS The following options are supported: .Bl -tag -width "-r newrelease" @@ -114,7 +114,7 @@ Please do not run from crontab or similar using this flag, see: .Nm Cm cron .It Fl -currently-running Ar release -Don't detect the currently-running release; instead, assume that the +Do not detect the currently-running release; instead, assume that the system is running the specified .Ar release . This is most likely to be useful when upgrading jails. diff --git a/usr.sbin/ifmcstat/ifmcstat.c b/usr.sbin/ifmcstat/ifmcstat.c index 4f3f444c276d..bbcacc349c35 100644 --- a/usr.sbin/ifmcstat/ifmcstat.c +++ b/usr.sbin/ifmcstat/ifmcstat.c @@ -805,7 +805,7 @@ inm_print_sources_sysctl(uint32_t ifindex, struct in_addr gina) uint32_t fmode; const char *modestr; - mibsize = sizeof(mib) / sizeof(mib[0]); + mibsize = nitems(mib); if (sysctlnametomib("net.inet.ip.mcast.filters", mib, &mibsize) == -1) { perror("sysctlnametomib"); return; @@ -814,7 +814,7 @@ inm_print_sources_sysctl(uint32_t ifindex, struct in_addr gina) needed = 0; mib[5] = ifindex; mib[6] = gina.s_addr; /* 32 bits wide */ - mibsize = sizeof(mib) / sizeof(mib[0]); + mibsize = nitems(mib); do { if (sysctl(mib, mibsize, NULL, &needed, NULL, 0) == -1) { perror("sysctl net.inet.ip.mcast.filters"); @@ -905,7 +905,7 @@ in6m_print_sources_sysctl(uint32_t ifindex, struct in6_addr *pgroup) uint32_t fmode; const char *modestr; - mibsize = sizeof(mib) / sizeof(mib[0]); + mibsize = nitems(mib); if (sysctlnametomib("net.inet6.ip6.mcast.filters", mib, &mibsize) == -1) { perror("sysctlnametomib"); @@ -918,7 +918,7 @@ in6m_print_sources_sysctl(uint32_t ifindex, struct in6_addr *pgroup) for (i = 0; i < 4; i++) mib[6 + i] = *pi++; - mibsize = sizeof(mib) / sizeof(mib[0]); + mibsize = nitems(mib); do { if (sysctl(mib, mibsize, NULL, &needed, NULL, 0) == -1) { perror("sysctl net.inet6.ip6.mcast.filters"); @@ -1145,7 +1145,7 @@ ifmcstat_getifmaddrs(void) size_t mibsize, len; int mib[5]; - mibsize = sizeof(mib) / sizeof(mib[0]); + mibsize = nitems(mib); if (sysctlnametomib("net.inet.igmp.ifinfo", mib, &mibsize) == -1) { perror("sysctlnametomib"); @@ -1170,7 +1170,7 @@ ifmcstat_getifmaddrs(void) size_t mibsize, len; int mib[5]; - mibsize = sizeof(mib) / sizeof(mib[0]); + mibsize = nitems(mib); if (sysctlnametomib("net.inet6.mld.ifinfo", mib, &mibsize) == -1) { perror("sysctlnametomib"); diff --git a/usr.sbin/ip6addrctl/ip6addrctl.c b/usr.sbin/ip6addrctl/ip6addrctl.c index d9bf89de68b7..79388ff28532 100644 --- a/usr.sbin/ip6addrctl/ip6addrctl.c +++ b/usr.sbin/ip6addrctl/ip6addrctl.c @@ -111,7 +111,7 @@ get_policy(void) struct in6_addrpolicy *buf; struct in6_addrpolicy *pol, *ep; - if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, &l, NULL, 0) < 0) { + if (sysctl(mib, nitems(mib), NULL, &l, NULL, 0) < 0) { err(1, "sysctl(IPV6CTL_ADDRCTLPOLICY)"); /* NOTREACHED */ } @@ -123,7 +123,7 @@ get_policy(void) errx(1, "malloc failed"); /* NOTREACHED */ } - if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), buf, &l, NULL, 0) < 0) { + if (sysctl(mib, nitems(mib), buf, &l, NULL, 0) < 0) { err(1, "sysctl(IPV6CTL_ADDRCTLPOLICY)"); /* NOTREACHED */ } diff --git a/usr.sbin/lpr/lpc/lpc.c b/usr.sbin/lpr/lpc/lpc.c index f1b0a7609ed7..a98ac7089a07 100644 --- a/usr.sbin/lpr/lpc/lpc.c +++ b/usr.sbin/lpr/lpc/lpc.c @@ -197,7 +197,7 @@ cmdscanner(void) makeargv(); if (margc == 0) continue; - if (el != NULL && el_parse(el, margc, margv) != -1) + if (el != NULL && el_parse(el, margc, (const char **)margv) != -1) continue; c = getcmd(margv[0]); diff --git a/usr.sbin/makefs/mtree.c b/usr.sbin/makefs/mtree.c index 0dcb45173123..69d3f516ea56 100644 --- a/usr.sbin/makefs/mtree.c +++ b/usr.sbin/makefs/mtree.c @@ -455,7 +455,7 @@ create_node(const char *name, u_int type, fsnode *parent, fsnode *global) n->inode = ecalloc(1, sizeof(*n->inode)); /* Assign global options/defaults. */ - bcopy(global->inode, n->inode, sizeof(*n->inode)); + memcpy(n->inode, global->inode, sizeof(*n->inode)); n->inode->st.st_mode = (n->inode->st.st_mode & ~S_IFMT) | n->type; if (n->type == S_IFLNK) @@ -1041,8 +1041,8 @@ read_mtree(const char *fname, fsnode *node) if (error) goto out; - bzero(&mtree_global, sizeof(mtree_global)); - bzero(&mtree_global_inode, sizeof(mtree_global_inode)); + memset(&mtree_global, 0, sizeof(mtree_global)); + memset(&mtree_global_inode, 0, sizeof(mtree_global_inode)); mtree_global.inode = &mtree_global_inode; mtree_global_inode.nlink = 1; mtree_global_inode.st.st_nlink = 1; diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c index 88b19b71e2bb..e021f6fb16b0 100644 --- a/usr.sbin/rpc.lockd/lockd.c +++ b/usr.sbin/rpc.lockd/lockd.c @@ -902,8 +902,7 @@ lookup_addresses(struct netconfig *nconf) sin->sin_port = htons(0); sin->sin_addr.s_addr = htonl(INADDR_ANY); res->ai_addr = (struct sockaddr*) sin; - res->ai_addrlen = (socklen_t) - sizeof(res->ai_addr); + res->ai_addrlen = sizeof(struct sockaddr_in); break; case AF_INET6: sin6 = malloc(sizeof(struct sockaddr_in6)); @@ -913,7 +912,7 @@ lookup_addresses(struct netconfig *nconf) sin6->sin6_port = htons(0); sin6->sin6_addr = in6addr_any; res->ai_addr = (struct sockaddr*) sin6; - res->ai_addrlen = (socklen_t) sizeof(res->ai_addr); + res->ai_addrlen = sizeof(struct sockaddr_in6); break; default: break; @@ -938,7 +937,7 @@ lookup_addresses(struct netconfig *nconf) } } - servaddr.len = servaddr.maxlen = res->ai_addr->sa_len; + servaddr.len = servaddr.maxlen = res->ai_addrlen; servaddr.buf = res->ai_addr; uaddr = taddr2uaddr(nconf, &servaddr); |