From e33acd92c323d70e5d6df57f002fc99962711614 Mon Sep 17 00:00:00 2001 From: ume Date: Wed, 9 Jan 2013 18:18:08 +0000 Subject: Add no_prefer_iface option. It stops treating the address on the interface as special by source address selection rule even when the interface is outgoing interface. This is desired in some situation. Requested by: hrs Reviewed by: IHANet folks including hrs MFC after: 1 week --- usr.sbin/ndp/ndp.8 | 11 ++++++++++- usr.sbin/ndp/ndp.c | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'usr.sbin') diff --git a/usr.sbin/ndp/ndp.8 b/usr.sbin/ndp/ndp.8 index 9eabfe4..223cfba 100644 --- a/usr.sbin/ndp/ndp.8 +++ b/usr.sbin/ndp/ndp.8 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 9, 2012 +.Dd Jan 10, 2013 .Dt NDP 8 .Os .\" @@ -192,6 +192,15 @@ on This flag is set by .Va net.inet6.ip6.auto_linklocal sysctl variable. +.It Ic no_prefer_iface +The address on the outgoing interface is preferred by source addess +selection rule. +If this flag is set, stop treating the address on the +.Ar interface +as special even when the +.Ar interface +is outgoing interface. +The default value of this flag is off. .It Ic disabled Disable IPv6 operation on the interface. When disabled, the interface discards any IPv6 packets diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index b50ddb7..866da76 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -982,6 +982,9 @@ ifinfo(ifname, argc, argv) #ifdef ND6_IFF_AUTO_LINKLOCAL SETFLAG("auto_linklocal", ND6_IFF_AUTO_LINKLOCAL); #endif +#ifdef ND6_IFF_NO_PREFER_IFACE + SETFLAG("no_prefer_iface", ND6_IFF_NO_PREFER_IFACE); +#endif SETVALUE("basereachable", ND.basereachable); SETVALUE("retrans", ND.retrans); SETVALUE("curhlim", ND.chlim); @@ -1055,6 +1058,10 @@ ifinfo(ifname, argc, argv) if ((ND.flags & ND6_IFF_AUTO_LINKLOCAL)) printf("auto_linklocal "); #endif +#ifdef ND6_IFF_NO_PREFER_IFACE + if ((ND.flags & ND6_IFF_NO_PREFER_IFACE)) + printf("no_prefer_iface "); +#endif } putc('\n', stdout); #undef ND -- cgit v1.1 From 8ab7717e288b7ee92b94499b85a61b53eaece449 Mon Sep 17 00:00:00 2001 From: brooks Date: Wed, 9 Jan 2013 21:07:08 +0000 Subject: Always install our mtree as /usr/sbin/fmtree and link it as /usr/sbin/mtree by default. Add a src.conf option WITH_NMTREE that causes NetBSD's mtree to be linked as /usr/sbin/mtree as well as /usr/sbin/nmtree. --- usr.sbin/mtree/Makefile | 16 ++++++++++++++-- usr.sbin/nmtree/Makefile | 7 +++++++ 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/mtree/Makefile b/usr.sbin/mtree/Makefile index cbc4fd9..c378455 100644 --- a/usr.sbin/mtree/Makefile +++ b/usr.sbin/mtree/Makefile @@ -1,10 +1,12 @@ # From: @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + .PATH: ${.CURDIR}/../../usr.bin/cksum -PROG= mtree -MAN= mtree.8 mtree.5 +PROG= fmtree +MAN= fmtree.8 mtree.5 SRCS= compare.c crc.c create.c excludes.c misc.c mtree.c spec.c verify.c SRCS+= specspec.c @@ -12,4 +14,14 @@ CFLAGS+= -DMD5 -DSHA1 -DRMD160 -DSHA256 DPADD= ${LIBMD} LDADD= -lmd +.if ${MK_NMTREE} == "no" +LINKS= ${BINDIR}/fmtree ${BINDIR}/mtree +MLINKS= fmtree.8 mtree.8 +.endif + +CLEANFILES+= fmtree.8 + +fmtree.8: mtree.8 + cp ${.ALLSRC} ${.TARGET} + .include diff --git a/usr.sbin/nmtree/Makefile b/usr.sbin/nmtree/Makefile index 58e46ea..1b8cc01 100644 --- a/usr.sbin/nmtree/Makefile +++ b/usr.sbin/nmtree/Makefile @@ -20,6 +20,13 @@ LIBNETBSD= ${LIBNETBSDDIR}/libnetbsd.a DPADD+= ${LIBNETBSD} LDADD+= ${LIBNETBSD} +.if ${MK_NMTREE} != "no" +LINKS= ${BINDIR}/nmtree ${BINDIR}/mtree +MLINKS= nmtree.8 mtree.8 +.endif + +CLEANFILES+= nmtree.8 + nmtree.8: mtree.8 cp ${.ALLSRC} ${.TARGET} -- cgit v1.1 From 1521a9209ea4a4aefabdb1a2de3c09c842bab24c Mon Sep 17 00:00:00 2001 From: joel Date: Sat, 12 Jan 2013 08:44:54 +0000 Subject: Remove EOL whitespace. --- usr.sbin/bsdinstall/partedit/sade.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr.sbin') diff --git a/usr.sbin/bsdinstall/partedit/sade.8 b/usr.sbin/bsdinstall/partedit/sade.8 index 8b2af49..441ddc0 100644 --- a/usr.sbin/bsdinstall/partedit/sade.8 +++ b/usr.sbin/bsdinstall/partedit/sade.8 @@ -56,7 +56,7 @@ in the post-installation environment. A program called .Nm first appeared in -.Fx 6.3 +.Fx 6.3 as a utility encapsulating features from the .Xr sysinstall 8 installer. It was replaced in -- cgit v1.1 From 06869490dedc635957de18958cbb53ad84132c36 Mon Sep 17 00:00:00 2001 From: nwhitehorn Date: Sat, 12 Jan 2013 16:01:58 +0000 Subject: Note that cpufreq(4) is not available on all hardware. PR: bin/175139 MFC after: 2 weeks --- usr.sbin/bsdinstall/scripts/services | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr.sbin') diff --git a/usr.sbin/bsdinstall/scripts/services b/usr.sbin/bsdinstall/scripts/services index 52aa57e..a4cfd46 100755 --- a/usr.sbin/bsdinstall/scripts/services +++ b/usr.sbin/bsdinstall/scripts/services @@ -45,7 +45,7 @@ DAEMONS=$(dialog --backtitle "FreeBSD Installer" \ sshd "Secure shell daemon" ${sshd_enable:-off} \ moused "PS/2 mouse pointer on console" ${moused_enable:-off} \ ntpd "Synchronize system and network time" ${ntpd_enable:-off} \ - powerd "Adjust CPU frequency dynamically" ${powerd_enable:-off} \ + powerd "Adjust CPU frequency dynamically if supported" ${powerd_enable:-off} \ 2>&1 1>&3) exec 3>&- -- cgit v1.1 From 1e25b1497aa9e77e4c8fee7c7ea8d0fbc28960a4 Mon Sep 17 00:00:00 2001 From: dteske Date: Mon, 14 Jan 2013 01:09:23 +0000 Subject: Add missing dialog(1) arguments to internationalize "Help"-button label. --- usr.sbin/bsdconfig/bsdconfig | 1 + usr.sbin/bsdconfig/networking/share/device.subr | 1 + usr.sbin/bsdconfig/security/kern_securelevel | 1 + usr.sbin/bsdconfig/usermgmt/usermgmt | 1 + 4 files changed, 4 insertions(+) (limited to 'usr.sbin') diff --git a/usr.sbin/bsdconfig/bsdconfig b/usr.sbin/bsdconfig/bsdconfig index 436b8a4..07b73fe 100755 --- a/usr.sbin/bsdconfig/bsdconfig +++ b/usr.sbin/bsdconfig/bsdconfig @@ -192,6 +192,7 @@ dialog_menu_main() --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_exit_bsdconfig\" \ --help-button \ + --help-label \"\$msg_help\" \ ${USE_XDIALOG:+--help \"\"} \ --menu \"\$prompt\" $size $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD diff --git a/usr.sbin/bsdconfig/networking/share/device.subr b/usr.sbin/bsdconfig/networking/share/device.subr index f77a5e7..bf44768 100644 --- a/usr.sbin/bsdconfig/networking/share/device.subr +++ b/usr.sbin/bsdconfig/networking/share/device.subr @@ -343,6 +343,7 @@ f_dialog_menu_netdev_edit() --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --help-button \ + --help-label \"\$msg_help\" \ ${USE_XDIALOG:+--help \"\"} \ --menu \"\$prompt\" $size \ $menu_list \ diff --git a/usr.sbin/bsdconfig/security/kern_securelevel b/usr.sbin/bsdconfig/security/kern_securelevel index 67fd1aa..42594c6 100755 --- a/usr.sbin/bsdconfig/security/kern_securelevel +++ b/usr.sbin/bsdconfig/security/kern_securelevel @@ -78,6 +78,7 @@ dialog_menu_main() --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --help-button \ + --help-label \"\$msg_help\" \ ${USE_XDIALOG:+--help \"\"} \ --menu \"\$prompt\" $size \ $menu_list \ diff --git a/usr.sbin/bsdconfig/usermgmt/usermgmt b/usr.sbin/bsdconfig/usermgmt/usermgmt index 5b69efd..5376bde 100755 --- a/usr.sbin/bsdconfig/usermgmt/usermgmt +++ b/usr.sbin/bsdconfig/usermgmt/usermgmt @@ -88,6 +88,7 @@ dialog_menu_main() --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --help-button \ + --help-label \"\$msg_help\" \ ${USE_XDIALOG:+--help \"\"} \ --menu \"\" $size $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD -- cgit v1.1 From 45e98a4654e7a3deac741a3a873b469ed7a4749f Mon Sep 17 00:00:00 2001 From: dteske Date: Mon, 14 Jan 2013 01:15:25 +0000 Subject: Add new f_yesno/f_noyes wrapper functions (which take printf(1) syntax). --- usr.sbin/bsdconfig/networking/share/device.subr | 5 ++- usr.sbin/bsdconfig/networking/share/hostname.subr | 6 ++-- usr.sbin/bsdconfig/networking/share/routing.subr | 7 ++-- usr.sbin/bsdconfig/share/common.subr | 44 +++++++++++++++++++++++ usr.sbin/bsdconfig/startup/rcdelete | 4 +-- 5 files changed, 51 insertions(+), 15 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/bsdconfig/networking/share/device.subr b/usr.sbin/bsdconfig/networking/share/device.subr index bf44768..23ac83b 100644 --- a/usr.sbin/bsdconfig/networking/share/device.subr +++ b/usr.sbin/bsdconfig/networking/share/device.subr @@ -456,9 +456,8 @@ f_dialog_menu_netdev_edit() # Re/Apply the settings if desired # if [ ! "$dhcp" ]; then - f_dialog_yesno "Would you like to bring the $interface" \ - "interface up right now?" - if [ $? -eq $SUCCESS ]; then + if f_yesno "$msg_bring_interface_up" "$interface" + then f_show_info "$msg_bring_interface_up" "$interface" local dr="$( f_sysrc_get defaultrouter )" err diff --git a/usr.sbin/bsdconfig/networking/share/hostname.subr b/usr.sbin/bsdconfig/networking/share/hostname.subr index 959c7df..b276059 100644 --- a/usr.sbin/bsdconfig/networking/share/hostname.subr +++ b/usr.sbin/bsdconfig/networking/share/hostname.subr @@ -201,10 +201,8 @@ f_dialog_input_hostname() f_show_msg "$msg_activate_hostname_x11warning" \ "$( hostname )" "$hostname" else - f_dialog_yesno "$( - printf "$msg_activate_hostname" \ - "$( hostname )" "$hostname" \ - )" \ + f_yesno "$msg_activate_hostname" \ + "$( hostname )" "$hostname" \ && hostname "$hostname" fi fi diff --git a/usr.sbin/bsdconfig/networking/share/routing.subr b/usr.sbin/bsdconfig/networking/share/routing.subr index 3990c03..4207ab2 100644 --- a/usr.sbin/bsdconfig/networking/share/routing.subr +++ b/usr.sbin/bsdconfig/networking/share/routing.subr @@ -129,11 +129,8 @@ f_dialog_input_defaultrouter() # if [ "$( f_route_get_default )" != "$defaultrouter" ]; then f_dialog_clear - f_dialog_yesno "$( - printf "$msg_activate_default_router" \ - "$( f_route_get_default )" "$defaultrouter" - )" - + f_yesno "$msg_activate_default_router" \ + "$( f_route_get_default )" "$defaultrouter" if [ $? -eq $SUCCESS ]; then local err diff --git a/usr.sbin/bsdconfig/share/common.subr b/usr.sbin/bsdconfig/share/common.subr index 05531aa..c66a54f 100644 --- a/usr.sbin/bsdconfig/share/common.subr +++ b/usr.sbin/bsdconfig/share/common.subr @@ -214,6 +214,50 @@ f_show_msg() fi } + +# f_yesno $fmt [ $opts ... ] +# +# Display a message in a dialog yes/no box using printf(1) syntax. +# +f_yesno() +{ + local msg + msg=$( printf "$@" ) + + # + # Use f_dialog_yesno from dialog.subr if possible, otherwise fall + # back to dialog(1) (without options, making it obvious when using + # un-aided system dialog). + # + if f_have f_dialog_yesno; then + f_dialog_yesno "$msg" + else + dialog --yesno "$msg" 0 0 + fi +} + +# f_noyes $fmt [ $opts ... ] +# +# Display a message in a dialog yes/no box using printf(1) syntax. +# NOTE: THis is just like the f_yesno function except "No" is default. +# +f_noyes() +{ + local msg + msg=$( printf "$@" ) + + # + # Use f_dialog_noyes from dialog.subr if possible, otherwise fall + # back to dialog(1) (without options, making it obvious when using + # un-aided system dialog). + # + if f_have f_dialog_noyes; then + f_dialog_noyes "$msg" + else + dialog --defaultno --yesno "$msg" 0 0 + fi +} + # f_show_help $file # # Display a language help-file. Automatically takes $LANG and $LC_ALL into diff --git a/usr.sbin/bsdconfig/startup/rcdelete b/usr.sbin/bsdconfig/startup/rcdelete index 02ec049..b0068f5 100755 --- a/usr.sbin/bsdconfig/startup/rcdelete +++ b/usr.sbin/bsdconfig/startup/rcdelete @@ -210,9 +210,7 @@ dialog_menu_delete() [ $# -ge 1 ] || return $FAILURE if [ $# -eq 1 ]; then - msg=$( printf "$msg_are_you_sure_you_want_to_delete" \ - "$delete_vars" ) - f_dialog_noyes "$msg" + f_noyes "$msg_are_you_sure_you_want_to_delete" "$delete_vars" return $? fi -- cgit v1.1 From a150559b39c68554c3b46f51c3a347efcdbd4f49 Mon Sep 17 00:00:00 2001 From: bapt Date: Mon, 14 Jan 2013 07:17:38 +0000 Subject: Directly uses calloc(3) instread of malloc(3) + memset(3) Reported by: Jeremy Chadwick MFC after: 3 days --- usr.sbin/pkg/dns_utils.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/pkg/dns_utils.c b/usr.sbin/pkg/dns_utils.c index e88bf98..239be90 100644 --- a/usr.sbin/pkg/dns_utils.c +++ b/usr.sbin/pkg/dns_utils.c @@ -66,10 +66,9 @@ dns_getsrvinfo(const char *zone) p += len + NS_QFIXEDSZ; } - res = malloc(sizeof(struct dns_srvinfo) * ancount); + res = calloc(ancount, sizeof(struct dns_srvinfo)); if (res == NULL) return (NULL); - memset(res, 0, sizeof(struct dns_srvinfo) * ancount); n = 0; while (ancount > 0 && p < end) { -- cgit v1.1 From 9bcfc5995dcac43a412f130666f5c7f2e676ce60 Mon Sep 17 00:00:00 2001 From: dteske Date: Mon, 14 Jan 2013 21:03:34 +0000 Subject: Don't use f_show_msg() unless printf(1) syntax is required (this reduces the number of unnecessary forks). --- usr.sbin/bsdconfig/console/ttys | 2 +- usr.sbin/bsdconfig/password/password | 2 +- usr.sbin/bsdconfig/password/share/password.subr | 4 +-- usr.sbin/bsdconfig/share/mustberoot.subr | 2 +- usr.sbin/bsdconfig/share/variable.subr | 4 +-- usr.sbin/bsdconfig/startup/misc | 22 +++++++-------- usr.sbin/bsdconfig/startup/rcdelete | 2 +- usr.sbin/bsdconfig/startup/rcvar | 2 +- usr.sbin/bsdconfig/startup/share/rcconf.subr | 4 +-- usr.sbin/bsdconfig/startup/share/rcedit.subr | 3 +- usr.sbin/bsdconfig/usermgmt/groupinput | 12 ++++---- usr.sbin/bsdconfig/usermgmt/share/group_input.subr | 6 ++-- usr.sbin/bsdconfig/usermgmt/share/user_input.subr | 16 ++++++----- usr.sbin/bsdconfig/usermgmt/userinput | 32 +++++++++++----------- 14 files changed, 57 insertions(+), 56 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/bsdconfig/console/ttys b/usr.sbin/bsdconfig/console/ttys index e1650da..3f9945e 100755 --- a/usr.sbin/bsdconfig/console/ttys +++ b/usr.sbin/bsdconfig/console/ttys @@ -192,7 +192,7 @@ while :; do err=$( ttys_set_type "$consterm" 2>&1 ) [ "$err" ] || break - f_show_msg "%s" "$err" + f_dialog_msgbox "$err" done exit $SUCCESS diff --git a/usr.sbin/bsdconfig/password/password b/usr.sbin/bsdconfig/password/password index 6b9e57d..50d963d 100755 --- a/usr.sbin/bsdconfig/password/password +++ b/usr.sbin/bsdconfig/password/password @@ -72,7 +72,7 @@ f_mustberoot_init if f_dialog_input_password; then err=$( echo "$pw_password" | pw usermod $USER_ROOT -h 0 2>&1 ) || f_die $? "%s" "$err" - f_show_msg "$msg_password_changed" + f_dialog_msgbox "$msg_password_changed" fi return $SUCCESS diff --git a/usr.sbin/bsdconfig/password/share/password.subr b/usr.sbin/bsdconfig/password/share/password.subr index bf83df7..f4ebaab9 100644 --- a/usr.sbin/bsdconfig/password/share/password.subr +++ b/usr.sbin/bsdconfig/password/share/password.subr @@ -108,13 +108,13 @@ f_dialog_input_password() # Check for NULL entry if ! [ "$_password1" -o "$_password2" ]; then - f_show_msg "$msg_password_is_empty" + f_dialog_msgbox "$msg_password_is_empty" continue fi # Check for password mismatch if [ "$_password1" != "$_password2" ]; then - f_show_msg "$msg_passwords_do_not_match" + f_dialog_msgbox "$msg_passwords_do_not_match" continue fi diff --git a/usr.sbin/bsdconfig/share/mustberoot.subr b/usr.sbin/bsdconfig/share/mustberoot.subr index ebce9c1..2ead592 100644 --- a/usr.sbin/bsdconfig/share/mustberoot.subr +++ b/usr.sbin/bsdconfig/share/mustberoot.subr @@ -128,7 +128,7 @@ f_become_root_via_sudo() 1) # Always try sudo(8) when run as $user local err if ! err=$( touch "$checkpath" 2>&1 ); then - f_show_msg "%s" "$err" + f_dialog_msgbox "$err" else f_show_msg "$msg_created_path" "$checkpath" fi diff --git a/usr.sbin/bsdconfig/share/variable.subr b/usr.sbin/bsdconfig/share/variable.subr index f63a5f8..235f6dc 100644 --- a/usr.sbin/bsdconfig/share/variable.subr +++ b/usr.sbin/bsdconfig/share/variable.subr @@ -118,7 +118,7 @@ f_variable_set_defaults() # # Dump a list of registered/advertised variables and their respective values to # $VARIABLE_DUMPFILE. Returns success unless the file couldn't be written. If -# an error occurs, it is displayed using f_show_msg() (from common.subr). +# an error occurs, it is displayed using f_dialog_msgbox() (from dialog.subr). # f_dump_variables() { @@ -131,7 +131,7 @@ f_dump_variables() printf "%s='%s'\n" "$var" "$value" done > "$VARIABLE_DUMPFILE" ) 2>&1 ); then - f_show_msg "%s" "$err" + f_dialog_msgbox "$err" return $FAILURE fi } diff --git a/usr.sbin/bsdconfig/startup/misc b/usr.sbin/bsdconfig/startup/misc index 626697a..37bb80f 100755 --- a/usr.sbin/bsdconfig/startup/misc +++ b/usr.sbin/bsdconfig/startup/misc @@ -307,14 +307,14 @@ while :; do ?" [X] "*) err=$( f_sysrc_set apm_enable NO 2>&1 ) ;; ?" [ ] "*) err=$( f_sysrc_set apm_enable YES 2>&1 ) ;; esac - [ $? -eq $SUCCESS ] || f_show_msg "%s\n" "$err" ;; + [ $? -eq $SUCCESS ] || f_dialog_msgbox "$err\n" ;; ?" ["?"] $msg_startup_dirs") dialog_input_value \ "$msg_startup_dirs_desc" \ "$( f_sysrc_get local_startup )" if [ $? -eq $SUCCESS ]; then err=$( f_sysrc_set local_startup "$value" ) || - f_show_msg "%s\n" "$err" + f_dialog_msgbox "$err\n" fi ;; ?" ["?"] $msg_named") @@ -322,14 +322,14 @@ while :; do ?" [X] "*) err=$( f_sysrc_set named_enable NO 2>&1 ) ;; ?" [ ] "*) err=$( f_sysrc_set named_enable YES 2>&1 ) ;; esac - [ $? -eq $SUCCESS ] || f_show_msg "%s\n" "$err" ;; + [ $? -eq $SUCCESS ] || f_dialog_msgbox "$err\n" ;; ?" ["?"] $msg_named_flags") dialog_input_value \ "$msg_named_flags_desc" \ "$( f_sysrc_get named_flags )" if [ $? -eq $SUCCESS ]; then err=$( f_sysrc_set named_flags "$value" ) || - f_show_msg "%s\n" "$err" + f_dialog_msgbox "$err\n" fi ;; ?" ["?"] $msg_nis_client") @@ -339,14 +339,14 @@ while :; do err=$( f_sysrc_set nis_client_enable YES 2>&1 ) \ && err=$( f_sysrc_set rpcbind_enable YES 2>&1 ) ;; esac - [ $? -eq $SUCCESS ] || f_show_msg "%s\n" "$err" ;; + [ $? -eq $SUCCESS ] || f_dialog_msgbox "$err\n" ;; ?" ["?"] $msg_nis_domainname") dialog_input_value \ "$msg_nis_domainname_desc" \ "$( f_sysrc_get nisdomainname )" if [ $? -eq $SUCCESS ]; then err=$( f_sysrc_set nisdomainname "$value" ) || - f_show_msg "%s\n" "$err" + f_dialog_msgbox "$err\n" fi ;; ?" ["?"] $msg_nis_server") @@ -356,31 +356,31 @@ while :; do err=$( f_sysrc_set nis_server_enable YES 2>&1 ) \ && err=$( f_sysrc_set rpcbind_enable YES 2>&1 ) ;; esac - [ $? -eq $SUCCESS ] || f_show_msg "%s\n" "$err" ;; + [ $? -eq $SUCCESS ] || f_dialog_msgbox "$err\n" ;; ?" ["?"] $msg_accounting") case "$mtag" in ?" [X] "*) err=$( f_sysrc_set accounting_enable NO 2>&1 ) ;; ?" [ ] "*) err=$( f_sysrc_set accounting_enable YES 2>&1 ) ;; esac - [ $? -eq $SUCCESS ] || f_show_msg "%s\n" "$err" ;; + [ $? -eq $SUCCESS ] || f_dialog_msgbox "$err\n" ;; ?" ["?"] $msg_lpd") case "$mtag" in ?" [X] "*) err=$( f_sysrc_set lpd_enable NO 2>&1 ) ;; ?" [ ] "*) err=$( f_sysrc_set lpd_enable YES 2>&1 ) ;; esac - [ $? -eq $SUCCESS ] || f_show_msg "%s\n" "$err" ;; + [ $? -eq $SUCCESS ] || f_dialog_msgbox "$err\n" ;; ?" ["?"] $msg_sco") case "$mtag" in ?" [X] "*) err=$( f_sysrc_set ibcs2_enable NO 2>&1 ) ;; ?" [ ] "*) err=$( f_sysrc_set ibcs2_enable YES 2>&1 ) ;; esac - [ $? -eq $SUCCESS ] || f_show_msg "%s\n" "$err" ;; + [ $? -eq $SUCCESS ] || f_dialog_msgbox "$err\n" ;; ?" ["?"] $msg_svr4") case "$mtag" in ?" [X] "*) err=$( f_sysrc_set svr4_enable NO 2>&1 ) ;; ?" [ ] "*) err=$( f_sysrc_set svr4_enable YES 2>&1 ) ;; esac - [ $? -eq $SUCCESS ] || f_show_msg "%s\n" "$err" ;; + [ $? -eq $SUCCESS ] || f_dialog_msgbox "$err\n" ;; esac done diff --git a/usr.sbin/bsdconfig/startup/rcdelete b/usr.sbin/bsdconfig/startup/rcdelete index b0068f5..578b13e 100755 --- a/usr.sbin/bsdconfig/startup/rcdelete +++ b/usr.sbin/bsdconfig/startup/rcdelete @@ -318,7 +318,7 @@ while :; do for var in $delete_vars; do err=$( f_sysrc_delete $var 2>&1 ) if [ $? -ne $SUCCESS ]; then - f_show_msg "%s\n" "$err" + f_dialog_msgbox "$err\n" break fi done diff --git a/usr.sbin/bsdconfig/startup/rcvar b/usr.sbin/bsdconfig/startup/rcvar index 8f27b51..d7ced9e 100755 --- a/usr.sbin/bsdconfig/startup/rcvar +++ b/usr.sbin/bsdconfig/startup/rcvar @@ -194,7 +194,7 @@ while :; do esac err=$( f_sysrc_set "$rcvar" "$value" 2>&1 ) || - f_show_msg "$err" + f_dialog_msgbox "$err" esac done diff --git a/usr.sbin/bsdconfig/startup/share/rcconf.subr b/usr.sbin/bsdconfig/startup/share/rcconf.subr index 8878d2c..12eafd9 100644 --- a/usr.sbin/bsdconfig/startup/share/rcconf.subr +++ b/usr.sbin/bsdconfig/startup/share/rcconf.subr @@ -432,14 +432,14 @@ f_dialog_input_rcvar() # Check for invalid entry (1of2) if ! echo "$_input" | grep -q "^[[:alpha:]_]"; then - f_show_msg "$msg_rcvar_must_start_with" + f_dialog_msgbox "$msg_rcvar_must_start_with" continue fi # Check for invalid entry (2of2) if ! echo "$_input" | grep -q "^[[:alpha:]_][[:alnum:]_]*$" then - f_show_msg "$msg_rcvar_contains_invalid_chars" + f_dialog_msgbox "$msg_rcvar_contains_invalid_chars" continue fi diff --git a/usr.sbin/bsdconfig/startup/share/rcedit.subr b/usr.sbin/bsdconfig/startup/share/rcedit.subr index a9cba88..cb4a411 100644 --- a/usr.sbin/bsdconfig/startup/share/rcedit.subr +++ b/usr.sbin/bsdconfig/startup/share/rcedit.subr @@ -78,8 +78,7 @@ f_dialog_rcedit() f_dprintf "%s: [%s]->[%s]" "$var" "$cur_val" "$_input" - err=$( f_sysrc_set "$var" "$_input" 2>&1 ) || - f_show_msg "$err" + err=$( f_sysrc_set "$var" "$_input" 2>&1 ) || f_dialog_msgbox "$err" } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/usermgmt/groupinput b/usr.sbin/bsdconfig/usermgmt/groupinput index 83d0c1d..c459224 100755 --- a/usr.sbin/bsdconfig/usermgmt/groupinput +++ b/usr.sbin/bsdconfig/usermgmt/groupinput @@ -63,10 +63,10 @@ save_changes() err=$( pw groupdel "$group_name" 2>&1 ) retval=$? if [ $retval -ne $SUCCESS ]; then - f_show_msg "%s %s\n" "$msg_error" "$err" + f_dialog_msgbox "$msg_error $err\n" return $retval fi - f_show_msg "$msg_group_deleted" + f_dialog_msgbox "$msg_group_deleted" ;; Add) local cmd="pw groupadd -n '$group_name'" @@ -82,10 +82,10 @@ save_changes() err=$( eval $cmd 2>&1 ) retval=$? if [ $retval -ne $SUCCESS ]; then - f_show_msg "%s %s\n" "$msg_error" "$err" + f_dialog_msgbox "$msg_error $err\n" return $retval fi - f_show_msg "$msg_group_added" + f_dialog_msgbox "$msg_group_added" ;; Edit/View) local cmd="pw groupmod -n '$group_name'" @@ -101,10 +101,10 @@ save_changes() err=$( eval $cmd 2>&1 ) retval=$? if [ $retval -ne $SUCCESS ]; then - f_show_msg "%s %s\n" "$msg_error" "$err" + f_dialog_msgbox "$msg_error $err\n" return $retval fi - f_show_msg "$msg_group_updated" + f_dialog_msgbox "$msg_group_updated" ;; esac diff --git a/usr.sbin/bsdconfig/usermgmt/share/group_input.subr b/usr.sbin/bsdconfig/usermgmt/share/group_input.subr index 4b47392..278e0a4 100644 --- a/usr.sbin/bsdconfig/usermgmt/share/group_input.subr +++ b/usr.sbin/bsdconfig/usermgmt/share/group_input.subr @@ -134,13 +134,13 @@ f_dialog_input_group_name() # Check for NULL entry if [ ! "$_input" ]; then - f_show_msg "$msg_group_is_empty" + f_dialog_msgbox "$msg_group_is_empty" continue fi # Check for invalid entry if ! echo "$_input" | grep -q "^[[:alpha:]]"; then - f_show_msg "$msg_group_must_start_with_letter" + f_dialog_msgbox "$msg_group_must_start_with_letter" continue fi @@ -229,7 +229,7 @@ f_dialog_input_group_password() # Check for password mismatch if [ "$_password1" != "$_password2" ]; then - f_show_msg "$msg_group_passwords_do_not_match" + f_dialog_msgbox "$msg_group_passwords_do_not_match" continue fi diff --git a/usr.sbin/bsdconfig/usermgmt/share/user_input.subr b/usr.sbin/bsdconfig/usermgmt/share/user_input.subr index d0b5fe3..e0281ed 100644 --- a/usr.sbin/bsdconfig/usermgmt/share/user_input.subr +++ b/usr.sbin/bsdconfig/usermgmt/share/user_input.subr @@ -239,13 +239,13 @@ f_dialog_input_name() # Check for NULL entry if [ ! "$_input" ]; then - f_show_msg "$msg_login_is_empty" + f_dialog_msgbox "$msg_login_is_empty" continue fi # Check for invalid entry if ! echo "$_input" | grep -q "^[[:alpha:]]"; then - f_show_msg "$msg_login_must_start_with_letter" + f_dialog_msgbox "$msg_login_must_start_with_letter" continue fi @@ -334,7 +334,7 @@ f_dialog_input_password() # Check for password mismatch if [ "$_password1" != "$_password2" ]; then - f_show_msg "$msg_passwords_do_not_match" + f_dialog_msgbox "$msg_passwords_do_not_match" continue fi @@ -589,7 +589,7 @@ f_dialog_input_change() # Taint-check the user's input if ! f_isinteger "$ret_days"; then - f_show_msg "$msg_invalid_number_of_days" + f_dialog_msgbox "$msg_invalid_number_of_days" continue fi @@ -616,7 +616,8 @@ f_dialog_input_change() # Taint-check the user's input if ! f_isinteger "${_input:-0}"; then - f_show_msg "$msg_invalid_number_of_seconds" + f_dialog_msgbox \ + "$msg_invalid_number_of_seconds" continue fi @@ -773,7 +774,7 @@ f_dialog_input_expire() # Taint-check the user's input if ! f_isinteger "$ret_days"; then - f_show_msg "$msg_invalid_number_of_days" + f_dialog_msgbox "$msg_invalid_number_of_days" continue fi @@ -800,7 +801,8 @@ f_dialog_input_expire() # Taint-check the user's input if ! f_isinteger "${_input:-0}"; then - f_show_msg "$msg_invalid_number_of_seconds" + f_dialog_msgbox \ + "$msg_invalid_number_of_seconds" continue fi diff --git a/usr.sbin/bsdconfig/usermgmt/userinput b/usr.sbin/bsdconfig/usermgmt/userinput index 36c43e1..ad62a09 100755 --- a/usr.sbin/bsdconfig/usermgmt/userinput +++ b/usr.sbin/bsdconfig/usermgmt/userinput @@ -81,22 +81,22 @@ save_changes() err=$( pw userdel -u "$pw_uid" 2>&1 ) retval=$? if [ $retval -ne $SUCCESS ]; then - f_show_msg "%s %s\n" "$msg_error" "$err" + f_dialog_msgbox "$msg_error $err\n" return $retval fi - f_show_msg "$msg_login_deleted" + f_dialog_msgbox "$msg_login_deleted" if [ "$pw_group_delete" = "$msg_yes" ] && f_quietly pw groupshow -g "$pw_gid" then err=$( pw groupdel -g "$pw_gid" 2>&1 ) || - f_show_msg "%s %s\n" "$msg_warning" "$err" + f_dialog_msgbox "$msg_warning $err\n" fi if [ "$pw_home_delete" = "$msg_yes" ]; then f_dialog_info "$msg_deleting_home_directory" err=$( rm -Rf "$pw_home_dir" 2>&1 ) || - f_show_msg "%s %s\n" "$msg_warning" "$err" + f_dialog_msgbox "$msg_warning $err\n" fi ;; Add) @@ -119,26 +119,26 @@ save_changes() err=$( eval $cmd 2>&1 ) retval=$? if [ $retval -ne $SUCCESS ]; then - f_show_msg "%s %s\n" "$msg_error" "$err" + f_dialog_msgbox "$msg_error $err\n" return $retval fi - f_show_msg "$msg_login_added" + f_dialog_msgbox "$msg_login_added" if [ "$pw_home_create" = "$msg_yes" ]; then err=$( mkdir -p "$pw_home_dir" 2>&1 ) if [ $? -ne $SUCCESS ]; then - f_show_msg "%s %s\n" "$msg_warning" "$err" + f_dialog_msgbox "$msg_warning $err\n" elif [ -e "$pw_home_dir" ]; then err=$( chown -R "$pw_uid:$pw_gid" \ "$pw_home_dir" 2>&1 ) - [ $? -eq $SUCCESS ] || f_show_msg \ - "%s %s\n" "$msg_warning" "$err" + [ $? -eq $SUCCESS ] || + f_dialog_msgbox "$msg_warning $err\n" fi fi if [ "$pw_dotfiles_create" = "$msg_yes" ]; then err=$( copy_dotfiles 2>&1 ) || - f_show_msg "%s %s\n" "$msg_warning" "$err" + f_dialog_msgbox "$msg_warning $err\n" fi user="$pw_name" @@ -165,26 +165,26 @@ save_changes() err=$( eval $cmd 2>&1 ) retval=$? if [ $retval -ne $SUCCESS ]; then - f_show_msg "%s %s\n" "$msg_error" "$err" + f_dialog_msgbox "$msg_error $err\n" return $retval fi - f_show_msg "$msg_login_updated" + f_dialog_msgbox "$msg_login_updated" if [ "$pw_home_create" = "$msg_yes" ]; then err=$( mkdir -p "$pw_home_dir" ) if [ $? -ne $SUCCESS ]; then - f_show_msg "%s %s\n" "$msg_warning" "$err" + f_dialog_msgbox "$msg_warning $err\n" elif [ -e "$pw_home_dir" ]; then err=$( chown -R "$pw_uid:$pw_gid" \ "$pw_home_dir" 2>&1 ) - [ $? -eq $SUCCESS ] || f_show_msg \ - "%s %s\n" "$msg_warning" "$err" + [ $? -eq $SUCCESS ] || + f_dialog_msgbox "$msg_warning $err\n" fi fi if [ "$pw_dotfiles_create" = "$msg_yes" ]; then err=$( copy_dotfiles 2>&1 ) || - f_show_msg "%s %s\n" "$msg_warning" "$err" + f_dialog_msgbox "$msg_warning $err\n" fi ;; esac -- cgit v1.1 From 01b3f1d63526dfaa1fb71e71019fb3772c6f86f2 Mon Sep 17 00:00:00 2001 From: eadler Date: Wed, 16 Jan 2013 05:00:51 +0000 Subject: Avoid clobbering errno with a call to fprintf PR: bin/173923 Submitted by: Garrett Cooper Approved by: cperciva MFC After: 3 days --- usr.sbin/cpucontrol/intel.c | 3 +++ usr.sbin/cpucontrol/via.c | 3 +++ 2 files changed, 6 insertions(+) (limited to 'usr.sbin') diff --git a/usr.sbin/cpucontrol/intel.c b/usr.sbin/cpucontrol/intel.c index 15ac939..96ab704 100644 --- a/usr.sbin/cpucontrol/intel.c +++ b/usr.sbin/cpucontrol/intel.c @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -266,7 +267,9 @@ matched: args.size = data_size; error = ioctl(devfd, CPUCTL_UPDATE, &args); if (error < 0) { + error = errno; fprintf(stderr, "failed.\n"); + errno = error; WARN(0, "ioctl()"); goto fail; } diff --git a/usr.sbin/cpucontrol/via.c b/usr.sbin/cpucontrol/via.c index 71ae406..d17e31f 100644 --- a/usr.sbin/cpucontrol/via.c +++ b/usr.sbin/cpucontrol/via.c @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -203,7 +204,9 @@ via_update(const char *dev, const char *path) args.size = data_size; error = ioctl(devfd, CPUCTL_UPDATE, &args); if (error < 0) { + error = errno; fprintf(stderr, "failed.\n"); + errno = error; WARN(0, "ioctl()"); goto fail; } -- cgit v1.1 From aa508f10e8cbfcec3a4e095e24c4294dcb49b7e2 Mon Sep 17 00:00:00 2001 From: eadler Date: Wed, 16 Jan 2013 05:03:49 +0000 Subject: Remove unused variables Approved by: cperciva MFC After: 3 days --- usr.sbin/pw/pw_log.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/pw/pw_log.c b/usr.sbin/pw/pw_log.c index f16274f..b774423 100644 --- a/usr.sbin/pw/pw_log.c +++ b/usr.sbin/pw/pw_log.c @@ -47,7 +47,6 @@ pw_log(struct userconf * cnf, int mode, int which, char const * fmt,...) } if (logfile != NULL) { va_list argp; - int l; time_t now = time(NULL); struct tm *t = localtime(&now); char nfmt[256]; @@ -57,7 +56,6 @@ pw_log(struct userconf * cnf, int mode, int which, char const * fmt,...) name = "unknown"; /* ISO 8601 International Standard Date format */ strftime(nfmt, sizeof nfmt, "%Y-%m-%d %T ", t); - l = strlen(nfmt); sprintf(nfmt + strlen(nfmt), "[%s:%s%s] %s\n", name, Which[which], Modes[mode], fmt); va_start(argp, fmt); vfprintf(logfile, nfmt, argp); -- cgit v1.1