From owner-svn-src-stable-9@freebsd.org Sun Jun 12 08:32:41 2016 Return-Path: Delivered-To: svn-src-stable-9@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B610CAF0ECF; Sun, 12 Jun 2016 08:32:41 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A1FB27BA; Sun, 12 Jun 2016 08:32:41 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5C8We1u075523; Sun, 12 Jun 2016 08:32:40 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5C8WdLZ075510; Sun, 12 Jun 2016 08:32:39 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201606120832.u5C8WdLZ075510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 12 Jun 2016 08:32:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r301837 - stable/9/contrib/top X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jun 2016 08:32:41 -0000 Author: ngie Date: Sun Jun 12 08:32:39 2016 New Revision: 301837 URL: https://svnweb.freebsd.org/changeset/base/301837 Log: MFstable/10 r301836: MFC r300395: Silence top(1) compiler warnings The contrib/top code is no longer maintained upstream (last pulled 16 years ago). The K&R-style followed by the code spews -Wimplicit-int and -Wreturn-type warnings, amongst others. This silences 131 warnings with as little modification as possible by adding necessary return types, definitions, headers, and header guards, and missing header includes. The 5 warnings that remain are due to undeclared ncurses references. I didn't include curses.h and term.h because there are several local functions and macros that conflict with those definitions. Added: stable/9/contrib/top/commands.h - copied unchanged from r301836, stable/10/contrib/top/commands.h stable/9/contrib/top/username.h - copied unchanged from r301836, stable/10/contrib/top/username.h Modified: stable/9/contrib/top/commands.c stable/9/contrib/top/display.c stable/9/contrib/top/display.h stable/9/contrib/top/machine.h stable/9/contrib/top/screen.c stable/9/contrib/top/screen.h stable/9/contrib/top/top.c stable/9/contrib/top/top.h stable/9/contrib/top/username.c stable/9/contrib/top/utils.h stable/9/contrib/top/version.c Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/top/ (props changed) Modified: stable/9/contrib/top/commands.c ============================================================================== --- stable/9/contrib/top/commands.c Sun Jun 12 05:57:42 2016 (r301836) +++ stable/9/contrib/top/commands.c Sun Jun 12 08:32:39 2016 (r301837) @@ -19,16 +19,21 @@ */ #include "os.h" -#include -#include -#include + #include #include +#include +#include +#include +#include + +#include "commands.h" #include "sigdesc.h" /* generated automatically */ #include "top.h" #include "boolean.h" #include "utils.h" +#include "machine.h" extern int errno; @@ -39,12 +44,15 @@ extern int overstrike; int err_compar(); char *err_string(); +static int str_adderr(char *str, int len, int err); +static int str_addarg(char *str, int len, char *arg, int first); /* * show_help() - display the help screen; invoked in response to * either 'h' or '?'. */ +void show_help() { @@ -123,6 +131,7 @@ register char *str; return(*str == '\0' ? NULL : str); } +int scanint(str, intp) char *str; @@ -262,6 +271,7 @@ char *err_string() * the string "str". */ +static int str_adderr(str, len, err) char *str; @@ -289,6 +299,7 @@ int err; * is set (indicating that a comma should NOT be added to the front). */ +static int str_addarg(str, len, arg, first) char *str; @@ -321,6 +332,7 @@ int first; * for sorting errors. */ +int err_compar(p1, p2) register struct errs *p1, *p2; @@ -339,6 +351,7 @@ register struct errs *p1, *p2; * error_count() - return the number of errors currently logged. */ +int error_count() { @@ -349,6 +362,7 @@ error_count() * show_errors() - display on stdout the current log of errors. */ +void show_errors() { Copied: stable/9/contrib/top/commands.h (from r301836, stable/10/contrib/top/commands.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/top/commands.h Sun Jun 12 08:32:39 2016 (r301837, copy of r301836, stable/10/contrib/top/commands.h) @@ -0,0 +1,21 @@ +/* + * Top users/processes display for Unix + * Version 3 + * + * This program may be freely redistributed, + * but this entire comment MUST remain intact. + * + * Copyright (c) 1984, 1989, William LeFebvre, Rice University + * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University + * Copyright (c) 2016, Randy Westlund + * + * $FreeBSD$ + */ +#ifndef COMMANDS_H +#define COMMANDS_H + +void show_errors(void); +int error_count(void); +void show_help(void); + +#endif /* COMMANDS_H */ Modified: stable/9/contrib/top/display.c ============================================================================== --- stable/9/contrib/top/display.c Sun Jun 12 05:57:42 2016 (r301836) +++ stable/9/contrib/top/display.c Sun Jun 12 08:32:39 2016 (r301837) @@ -29,9 +29,12 @@ */ #include "os.h" + +#include + #include #include -#include +#include #include "screen.h" /* interface to screen package */ #include "layout.h" /* defines for screen position layout */ @@ -56,7 +59,6 @@ static int display_width = MAX_COLS; #define lineindex(l) ((l)*display_width) -char *printable(); /* things initialized by display_init and used thruout */ @@ -239,6 +241,7 @@ struct statics *statics; return(lines); } +void i_loadave(mpid, avenrun) int mpid; @@ -267,6 +270,7 @@ double *avenrun; lmpid = mpid; } +void u_loadave(mpid, avenrun) int mpid; @@ -306,6 +310,7 @@ double *avenrun; } } +void i_timeofday(tod) time_t *tod; @@ -351,6 +356,7 @@ static char procstates_buffer[MAX_COLS]; * lastline is valid */ +void i_procstates(total, brkdn) int total; @@ -378,6 +384,7 @@ int *brkdn; memcpy(lprocstates, brkdn, num_procstates * sizeof(int)); } +void u_procstates(total, brkdn) int total; @@ -460,9 +467,10 @@ char *cpustates_tag() } #endif +void i_cpustates(states) -register int *states; +int *states; { register int i = 0; @@ -505,9 +513,10 @@ for (cpu = 0; cpu < num_cpus; cpu++) { memcpy(lcpustates, states, num_cpustates * sizeof(int) * num_cpus); } +void u_cpustates(states) -register int *states; +int *states; { register int value; @@ -557,6 +566,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) { } } +void z_cpustates() { @@ -606,6 +616,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) { char memory_buffer[MAX_COLS]; +void i_memory(stats) int *stats; @@ -619,6 +630,7 @@ int *stats; fputs(memory_buffer, stdout); } +void u_memory(stats) int *stats; @@ -639,13 +651,14 @@ int *stats; */ char arc_buffer[MAX_COLS]; +void i_arc(stats) int *stats; { if (arc_names == NULL) - return (0); + return; fputs("\nARC: ", stdout); lastline++; @@ -655,6 +668,7 @@ int *stats; fputs(arc_buffer, stdout); } +void u_arc(stats) int *stats; @@ -663,7 +677,7 @@ int *stats; static char new[MAX_COLS]; if (arc_names == NULL) - return (0); + return; /* format the new line */ summary_format(new, stats, arc_names); @@ -680,6 +694,7 @@ int *stats; char swap_buffer[MAX_COLS]; +void i_swap(stats) int *stats; @@ -693,6 +708,7 @@ int *stats; fputs(swap_buffer, stdout); } +void u_swap(stats) int *stats; @@ -724,6 +740,7 @@ static int msglen = 0; /* Invariant: msglen is always the length of the message currently displayed on the screen (even when next_msg doesn't contain that message). */ +void i_message() { @@ -745,6 +762,7 @@ i_message() } } +void u_message() { @@ -786,6 +804,7 @@ char *text; * Assumptions: cursor is on the previous line and lastline is consistent */ +void i_header(text) char *text; @@ -811,9 +830,10 @@ char *text; } /*ARGSUSED*/ +void u_header(text) -char *text; /* ignored */ +char *text __unused; /* ignored */ { @@ -832,6 +852,7 @@ char *text; /* ignored */ * Assumptions: lastline is consistent */ +void i_process(line, thisline) int line; @@ -862,6 +883,7 @@ char *thisline; memzero(p, display_width - (p - base)); } +void u_process(line, newline) int line; @@ -909,9 +931,10 @@ char *newline; } } +void u_endscreen(hi) -register int hi; +int hi; { register int screen_line = hi + Header_lines; @@ -969,6 +992,7 @@ register int hi; } } +void display_header(t) int t; @@ -985,6 +1009,7 @@ int t; } /*VARARGS2*/ +void new_message(type, msgfmt, a1, a2, a3) int type; @@ -1025,6 +1050,7 @@ caddr_t a1, a2, a3; } } +void clear_message() { @@ -1034,6 +1060,7 @@ clear_message() } } +int readline(buffer, size, numeric) char *buffer; @@ -1336,6 +1363,7 @@ char *str; return(str); } +void i_uptime(bt, tod) struct timeval* bt; Modified: stable/9/contrib/top/display.h ============================================================================== --- stable/9/contrib/top/display.h Sun Jun 12 05:57:42 2016 (r301836) +++ stable/9/contrib/top/display.h Sun Jun 12 08:32:39 2016 (r301837) @@ -5,3 +5,37 @@ #define MT_standout 1 #define MT_delayed 2 +#include "machine.h" + +int display_updatecpus(struct statics *statics); +void clear_message(void); +int display_resize(void); +void i_header(char *text); +char *printable(char *string); +char *cpustates_tag(void); +void display_header(int t); +int display_init(struct statics *statics); +void i_arc(int *stats); +void i_cpustates(int *states); +void i_loadave(int mpid, double *avenrun); +void i_memory(int *stats); +void i_message(void); +void i_process(int line, char *thisline); +void i_procstates(int total, int *brkdn); +void i_swap(int *stats); +void i_timeofday(time_t *tod); +void i_uptime(struct timeval *bt, time_t *tod); +void new_message(); +int readline(char *buffer, int size, int numeric); +char *trim_header(char *text); +void u_arc(int *stats); +void u_cpustates(int *states); +void u_endscreen(int hi); +void u_header(char *text); +void u_loadave(int mpid, double *avenrun); +void u_memory(int *stats); +void u_message(void); +void u_process(int line, char *newline); +void u_procstates(int total, int *brkdn); +void u_swap(int *stats); +void z_cpustates(void); Modified: stable/9/contrib/top/machine.h ============================================================================== --- stable/9/contrib/top/machine.h Sun Jun 12 05:57:42 2016 (r301836) +++ stable/9/contrib/top/machine.h Sun Jun 12 08:32:39 2016 (r301837) @@ -7,6 +7,10 @@ * module. It is NOT machine dependent and should not need to be changed * for any specific machine. */ +#ifndef MACHINE_H +#define MACHINE_H + +#include "top.h" /* * the statics struct is filled in by machine_init @@ -74,8 +78,14 @@ struct process_select /* routines defined by the machine dependent module */ -char *format_header(); -char *format_next_process(); +char *format_header(); +char *format_next_process(); +void toggle_pcpustats(void); +void get_system_info(struct system_info *si); +int machine_init(struct statics *statics, char do_unames); +int proc_owner(int pid); /* non-int routines typically used by the machine dependent module */ -char *printable(); +char *printable(); + +#endif /* MACHINE_H */ Modified: stable/9/contrib/top/screen.c ============================================================================== --- stable/9/contrib/top/screen.c Sun Jun 12 05:57:42 2016 (r301836) +++ stable/9/contrib/top/screen.c Sun Jun 12 08:32:39 2016 (r301837) @@ -50,7 +50,6 @@ extern char *myname; -int putstdout(); int overstrike; int screen_length; @@ -236,6 +235,7 @@ int interactive; #endif } +void init_screen() { @@ -326,6 +326,7 @@ init_screen() } } +void end_screen() { @@ -356,6 +357,7 @@ end_screen() } } +void reinit_screen() { @@ -383,6 +385,7 @@ reinit_screen() } } +void get_screensize() { @@ -428,6 +431,7 @@ get_screensize() lower_left[sizeof(lower_left) - 1] = '\0'; } +void standout(msg) char *msg; @@ -445,6 +449,7 @@ char *msg; } } +void clear() { @@ -454,6 +459,7 @@ clear() } } +int clear_eol(len) int len; @@ -478,6 +484,7 @@ int len; return(-1); } +void go_home() { @@ -489,6 +496,7 @@ go_home() /* This has to be defined as a subroutine for tputs (instead of a macro) */ +void putstdout(ch) char ch; Modified: stable/9/contrib/top/screen.h ============================================================================== --- stable/9/contrib/top/screen.h Sun Jun 12 05:57:42 2016 (r301836) +++ stable/9/contrib/top/screen.h Sun Jun 12 08:32:39 2016 (r301837) @@ -28,4 +28,14 @@ extern int screen_length; extern int screen_width; /* a function that puts a single character on stdout */ -int putstdout(); +void putstdout(char ch); +int clear_eol(int len); +void standout(char *msg); +void clear(void); +void go_home(void); +void reinit_screen(void); +void get_screensize(void); +void init_termcap(int interactive); +void end_screen(void); +void init_screen(void); + Modified: stable/9/contrib/top/top.c ============================================================================== --- stable/9/contrib/top/top.c Sun Jun 12 05:57:42 2016 (r301836) +++ stable/9/contrib/top/top.c Sun Jun 12 08:32:39 2016 (r301837) @@ -34,15 +34,19 @@ char *copyright = */ #include "os.h" -#include -#include -#include -#include + #include #include + +#include +#include #include +#include +#include +#include /* includes specific to top */ +#include "commands.h" #include "display.h" /* interface to display package */ #include "screen.h" /* interface to screen package */ #include "top.h" @@ -50,6 +54,7 @@ char *copyright = #include "boolean.h" #include "machine.h" #include "utils.h" +#include "username.h" /* Size of the stdio buffer given to stdout */ #define Buffersize 2048 @@ -114,38 +119,21 @@ caddr_t get_process_info(); char *username(); char *itoa7(); -/* display routines that need to be predeclared */ -int i_loadave(); -int u_loadave(); -int i_procstates(); -int u_procstates(); -int i_cpustates(); -int u_cpustates(); -int i_memory(); -int u_memory(); -int i_arc(); -int u_arc(); -int i_swap(); -int u_swap(); -int i_message(); -int u_message(); -int i_header(); -int u_header(); -int i_process(); -int u_process(); - /* pointers to display routines */ -int (*d_loadave)() = i_loadave; -int (*d_procstates)() = i_procstates; -int (*d_cpustates)() = i_cpustates; -int (*d_memory)() = i_memory; -int (*d_arc)() = i_arc; -int (*d_swap)() = i_swap; -int (*d_message)() = i_message; -int (*d_header)() = i_header; -int (*d_process)() = i_process; +void (*d_loadave)() = i_loadave; +void (*d_procstates)() = i_procstates; +void (*d_cpustates)() = i_cpustates; +void (*d_memory)() = i_memory; +void (*d_arc)() = i_arc; +void (*d_swap)() = i_swap; +void (*d_message)() = i_message; +void (*d_header)() = i_header; +void (*d_process)() = i_process; + +void reset_display(void); +int main(argc, argv) int argc; @@ -1178,6 +1166,7 @@ restart: * screen will get redrawn. */ +void reset_display() { Modified: stable/9/contrib/top/top.h ============================================================================== --- stable/9/contrib/top/top.h Sun Jun 12 05:57:42 2016 (r301836) +++ stable/9/contrib/top/top.h Sun Jun 12 08:32:39 2016 (r301837) @@ -7,6 +7,9 @@ * General (global) definitions */ +#ifndef TOP_H +#define TOP_H + /* Current major version number */ #define VERSION 3 @@ -47,3 +50,5 @@ enum displaymodes { DISP_CPU = 0, DISP_I extern enum displaymodes displaymode; extern int pcpu_stats; + +#endif /* TOP_H */ Modified: stable/9/contrib/top/username.c ============================================================================== --- stable/9/contrib/top/username.c Sun Jun 12 05:57:42 2016 (r301836) +++ stable/9/contrib/top/username.c Sun Jun 12 08:32:39 2016 (r301837) @@ -32,11 +32,15 @@ #include #include -#include + #include +#include +#include +#include #include "top.local.h" #include "utils.h" +#include "username.h" struct hash_el { int uid; @@ -55,6 +59,8 @@ struct hash_el { /* We depend on that for hash_table and YOUR compiler had BETTER do it! */ struct hash_el hash_table[Table_size]; + +void init_hash() { @@ -67,7 +73,7 @@ init_hash() char *username(uid) -register int uid; +int uid; { register int hashindex; @@ -106,8 +112,8 @@ char *username; int enter_user(uid, name, wecare) -register int uid; -register char *name; +int uid; +char *name; int wecare; /* 1 = enter it always, 0 = nice to have */ { @@ -142,7 +148,7 @@ int wecare; /* 1 = enter it always, 0 = int get_user(uid) -register int uid; +int uid; { struct passwd *pwd; Copied: stable/9/contrib/top/username.h (from r301836, stable/10/contrib/top/username.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/top/username.h Sun Jun 12 08:32:39 2016 (r301837, copy of r301836, stable/10/contrib/top/username.h) @@ -0,0 +1,23 @@ +/* + * Top users/processes display for Unix + * Version 3 + * + * This program may be freely redistributed, + * but this entire comment MUST remain intact. + * + * Copyright (c) 1984, 1989, William LeFebvre, Rice University + * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University + * Copyright (c) 2016, Randy Westlund + * + * $FreeBSD$ + */ +#ifndef USERNAME_H +#define USERNAME_H + +int enter_user(int uid, char *name, int wecare); +int get_user(int uid); +void init_hash(void); +char *username(int uid); +int userid(char *username); + +#endif /* USERNAME_H */ Modified: stable/9/contrib/top/utils.h ============================================================================== --- stable/9/contrib/top/utils.h Sun Jun 12 05:57:42 2016 (r301836) +++ stable/9/contrib/top/utils.h Sun Jun 12 08:32:39 2016 (r301837) @@ -22,3 +22,5 @@ char *errmsg(); char *format_time(); char *format_k(); char *format_k2(unsigned long long); +int string_index(char *string, char **array); + Modified: stable/9/contrib/top/version.c ============================================================================== --- stable/9/contrib/top/version.c Sun Jun 12 05:57:42 2016 (r301836) +++ stable/9/contrib/top/version.c Sun Jun 12 08:32:39 2016 (r301837) @@ -9,6 +9,9 @@ * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University */ +#include +#include + #include "top.h" #include "patchlevel.h" From owner-svn-src-stable-9@freebsd.org Wed Jun 15 14:12:23 2016 Return-Path: Delivered-To: svn-src-stable-9@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1C39A44196; Wed, 15 Jun 2016 14:12:23 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A14FC1C19; Wed, 15 Jun 2016 14:12:23 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5FECMgQ095508; Wed, 15 Jun 2016 14:12:22 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5FECMY8095507; Wed, 15 Jun 2016 14:12:22 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201606151412.u5FECMY8095507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Wed, 15 Jun 2016 14:12:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r301927 - stable/9/usr.sbin/newsyslog X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jun 2016 14:12:23 -0000 Author: vangyzen Date: Wed Jun 15 14:12:22 2016 New Revision: 301927 URL: https://svnweb.freebsd.org/changeset/base/301927 Log: MFC r301532 newsyslog: Eliminate unnecessary sleep(10) when -R and -s are specified After going through the signal work list, during which do_sigwork() is called and essentially does nothing because -s and -R were specified on the command line, newsyslog will sleep for 10 seconds as the (verbose) code says: "Pause 10 seconds to allow daemon(s) to close log file(s)". However, the man page verbiage for -R (and -s) seems quite clear that this sleep() is unnecessary because the daemon was expected to have already closed the log file before calling newsyslog. PR: 210020 Submitted by: David A. Bright Sponsored by: Dell Inc. Modified: stable/9/usr.sbin/newsyslog/newsyslog.c Directory Properties: stable/9/usr.sbin/newsyslog/ (props changed) Modified: stable/9/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- stable/9/usr.sbin/newsyslog/newsyslog.c Wed Jun 15 14:11:49 2016 (r301926) +++ stable/9/usr.sbin/newsyslog/newsyslog.c Wed Jun 15 14:12:22 2016 (r301927) @@ -330,13 +330,15 @@ main(int argc, char **argv) printf("Signal all daemon process(es)...\n"); SLIST_FOREACH(stmp, &swhead, sw_nextp) do_sigwork(stmp); - if (noaction) - printf("\tsleep 10\n"); - else { - if (verbose) - printf("Pause 10 seconds to allow daemon(s)" - " to close log file(s)\n"); - sleep(10); + if (!(rotatereq && nosignal)) { + if (noaction) + printf("\tsleep 10\n"); + else { + if (verbose) + printf("Pause 10 seconds to allow " + "daemon(s) to close log file(s)\n"); + sleep(10); + } } } /* From owner-svn-src-stable-9@freebsd.org Fri Jun 17 02:31:20 2016 Return-Path: Delivered-To: svn-src-stable-9@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EABBA47BD1; Fri, 17 Jun 2016 02:31:20 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D72D92F3F; Fri, 17 Jun 2016 02:31:19 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5H2VJ6D069652; Fri, 17 Jun 2016 02:31:19 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5H2VIvP069650; Fri, 17 Jun 2016 02:31:18 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201606170231.u5H2VIvP069650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 17 Jun 2016 02:31:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r301977 - in stable/9/contrib/gcclibs: include libiberty X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jun 2016 02:31:20 -0000 Author: pfg Date: Fri Jun 17 02:31:18 2016 New Revision: 301977 URL: https://svnweb.freebsd.org/changeset/base/301977 Log: MFC r301291: libiberty: prevent integer overflow. Take care of very old bug leading to heap-buffer overflow by processing certain file headers via bfd binary. PR: 200888 Obtained from: OpenBSD Modified: stable/9/contrib/gcclibs/include/objalloc.h stable/9/contrib/gcclibs/libiberty/objalloc.c Directory Properties: stable/9/contrib/gcclibs/ (props changed) Modified: stable/9/contrib/gcclibs/include/objalloc.h ============================================================================== --- stable/9/contrib/gcclibs/include/objalloc.h Fri Jun 17 02:29:55 2016 (r301976) +++ stable/9/contrib/gcclibs/include/objalloc.h Fri Jun 17 02:31:18 2016 (r301977) @@ -1,5 +1,5 @@ /* objalloc.h -- routines to allocate memory for objects - Copyright 1997, 2001 Free Software Foundation, Inc. + Copyright 1997, 2001-2012 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Solutions. This program is free software; you can redistribute it and/or modify it @@ -91,7 +91,7 @@ extern void *_objalloc_alloc (struct obj if (__len == 0) \ __len = 1; \ __len = (__len + OBJALLOC_ALIGN - 1) &~ (OBJALLOC_ALIGN - 1); \ - (__len <= __o->current_space \ + (__len != 0 && __len <= __o->current_space \ ? (__o->current_ptr += __len, \ __o->current_space -= __len, \ (void *) (__o->current_ptr - __len)) \ Modified: stable/9/contrib/gcclibs/libiberty/objalloc.c ============================================================================== --- stable/9/contrib/gcclibs/libiberty/objalloc.c Fri Jun 17 02:29:55 2016 (r301976) +++ stable/9/contrib/gcclibs/libiberty/objalloc.c Fri Jun 17 02:31:18 2016 (r301977) @@ -1,5 +1,5 @@ /* objalloc.c -- routines to allocate memory for objects - Copyright 1997 Free Software Foundation, Inc. + Copyright 1997-2012 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Solutions. This program is free software; you can redistribute it and/or modify it @@ -112,8 +112,10 @@ objalloc_create (void) /* Allocate space from an objalloc structure. */ PTR -_objalloc_alloc (struct objalloc *o, unsigned long len) +_objalloc_alloc (struct objalloc *o, unsigned long original_len) { + unsigned long len = original_len; + /* We avoid confusion from zero sized objects by always allocating at least 1 byte. */ if (len == 0) @@ -121,6 +123,11 @@ _objalloc_alloc (struct objalloc *o, uns len = (len + OBJALLOC_ALIGN - 1) &~ (OBJALLOC_ALIGN - 1); + /* CVE-2012-3509: Check for overflow in the alignment operation above + * and then malloc argument below. */ + if (len + CHUNK_HEADER_SIZE < original_len) + return NULL; + if (len <= o->current_space) { o->current_ptr += len;