Commit Graph

103 Commits

Author SHA1 Message Date
Pedro F. Giffuni
c8aa42a2da Undo the bogus gethostname() change from r299709.
The "- 1" is there specifically to enable checking for NUL termination.

I should also admit the rest change was mostly cosmetic and the
overruns can't occur in practice: still I leave them to pacify
static analyzers.

Pointed out by:	bde
2016-05-14 04:29:13 +00:00
Pedro F. Giffuni
cbc796fb90 timed(8): Use strlcpy() for bounds checking.
Prevent some theorical buffer overruns reported by Coverity.
Cleanup a use of gethostname() while here.

CID:	1006713, 1011166, 1011167, 1011168,
2016-05-14 02:42:09 +00:00
Pedro F. Giffuni
555470a31d timed(8): Use stronger random number generator.
Using arc4random simplifies the code by not having to worry about
seeds which ironically depend on the time.

CID:	1300004
2016-05-14 01:12:23 +00:00
Pedro F. Giffuni
7ffbd1b5b0 timed(8): use NULL instead of zero for pointers. 2016-05-14 00:46:38 +00:00
Don Lewis
5d29410d37 Use strlcpy() instead of strncpy() to ensure that ret->name is
NUL terminated.  The source and destination buffers are the same
size and the source *should* be NUL terminated, but be paranoid.

Reported by:	Coverity
CID:		1011274
MFC after:	1 week
2016-05-13 00:17:57 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Baptiste Daroussin
c6db8143ed Convert usr.sbin to LIBADD
Reduce overlinking
2014-11-25 16:57:27 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Neel Natu
06224a9492 Remove LOG_ODELAY because it does nothing.
Reviewed by:	jilles
CR:		https://reviews.freebsd.org/D611
2014-08-17 19:06:26 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Joel Dahl
6a7ac072e5 Minor update about rc.conf. 2013-04-22 18:31:39 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Philippe Charnier
acd8b77456 Change old-style function definition 2013-02-01 14:26:54 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Kevin Lo
8840ea45ae Add missing braces
Obtained from:	DragonFly
2012-09-12 10:16:39 +00:00
Ed Schouten
902d9eafbf Rework all non-contributed files that use `struct timezone'.
This structure is not part of POSIX. According to POSIX, gettimeofday()
has the following prototype:

	int gettimeofday(struct timeval *restrict tp, void *restrict tzp);

Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is
not used). Remove dead error handling code. Also use NULL for a
nul-pointer instead of integer 0.

While there, change all pieces of code that only use tv_sec to use
time(3), as this provides less overhead.
2012-09-01 14:45:15 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Eitan Adler
50d675f7a9 Remove trailing whitespace per mdoc lint warning
Disussed with:	gavin
No objection from:	doc
Approved by:	joel
MFC after:	3 days
2012-03-29 05:02:12 +00:00
Kevin Lo
a3a2bf4b67 fgets(3) returns a pointer, so compare against NULL, not integer 0. 2012-01-13 06:51:15 +00:00
Ulrich Spörlein
3df5ecac8c Spelling fixes for usr.sbin/ 2011-12-30 10:58:14 +00:00
Dimitry Andric
5c67a2799c Fix r228719; when you use intmax_t, you need stdint.h.
Pointy hat to:	dim
MFC after:	1 week
2011-12-19 20:33:53 +00:00
Dimitry Andric
655353a78c Some people pointed out long is 32-bit on some arches, while time_t is
64-bit, so better cast time_t to intmax_t, and use the appropriate
printf format strings.

MFC after:	1 week
2011-12-19 20:29:50 +00:00
Dimitry Andric
ad5b59d82c In usr.sbin/timed, fix several issues with printf formats:
- Cast time_t's to long, and print them with %ld.
- Print ptrdiff_t's with %td.
- Print ssize_t's and size_t's with %zd and %zu.
- Print int32_t's with %d.
Also, replace some int variables with the more appropriate size_t.

MFC after:	1 week
2011-12-19 18:08:31 +00:00
Ed Schouten
acd29a915f Simplify inclusion of the tsptype array a bit.
We don't need this array in timed.c -- only readmsg.c.
2011-11-06 16:37:15 +00:00
Simon L. B. Nielsen
1ae2ca130d Check return code of setuid() in timedc.
While it will not fail in normal circumstances, better safe than
sorry.

MFC after:	3 days
2011-04-23 13:57:12 +00:00
Joel Dahl
914e11a72b Remove the advertising clause from UCB copyrighted files in usr.sbin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
2010-12-11 09:38:12 +00:00
Ulrich Spörlein
cded07a878 Move most of the remaining USD/PSD/SMM papers into share/doc 2010-12-04 10:11:20 +00:00
Gavin Atkinson
913a61f799 Initialise the "trials" variable to zero earlier in case we unexpectedly
error out early.

Found by:	clang static analyzer
2010-06-19 17:04:01 +00:00
Ulrich Spörlein
c71e97c47e mdoc: replace troff macros with -mdoc equivalents 2010-06-08 16:48:49 +00:00
Ed Schouten
e4ce5cb26c Port timed away from logwtmp(3). Let it use utmpx. 2010-01-13 18:15:46 +00:00
Ed Schouten
a9d25ec695 Fix LLVM compiler errors related to K&R declarations with ANSI prototypes.
Submitted by:	Pawel Worach <pawel.worach@gmail.com>
2009-02-26 20:59:05 +00:00
Xin LI
6b41097822 Remove spurious duplicated defination of sock. 2008-09-24 00:04:51 +00:00
Warner Losh
047b4ae4cf getopt returns an int, not a char. Make sure that we store the
variable in an int to avoid casting to an unsigned value which causes
the comparison with -1 to fail.

PR:		123807
Submitted by:	Matthew Luckie
Reviewed by:	keramida@
MFC after:	1 week
2008-06-02 04:50:47 +00:00
Remko Lodder
f7769a0c07 Typo fix.
Spotted by:	brueffer
2008-02-11 08:12:58 +00:00
Remko Lodder
d7cb71e0df Enhance descriptions in the timed manual.
PR:		docs/115445
Submitted by:	"Julian Stacey" <jhs at berklix dot org>
MFC After:	3 days
2007-12-08 20:04:15 +00:00
Kevin Lo
784bddbc5b Cleanup of userland __P use 2007-11-07 10:53:41 +00:00
Maxim Konovalov
ba5b74d001 o Remove duplicate includes.
Obtained from:	Slava Semushin via NetBSD
2007-01-20 08:24:02 +00:00
Ruslan Ermilov
59a3c79da6 Sort sections. 2005-01-18 20:02:45 +00:00
Ruslan Ermilov
07bfccd71e Mechanically kill hard sentence breaks. 2004-07-02 23:13:00 +00:00
Johan Karlsson
84d018e017 Fix typo, s/transmitts/transmits/
PR:		62346
Submitted by:	Gavin Atkinson (gavin at ury.york.ac.uk)
2004-02-04 21:59:29 +00:00
Tim J. Robbins
acb85bc034 Fix a BSS buffer overflow caused by makeargv() writing past the end of
margv[] when an input line contains 20 or more space-separated words.
2003-10-11 07:35:35 +00:00
Christian Weisgerber
fc3b13fcee missing word 2003-10-04 15:43:22 +00:00
Christian Weisgerber
c698f34f6c reference ntpd(8) 2003-10-04 15:07:27 +00:00
Christian Weisgerber
9a0e785bba Mark the -i and -n options as mutually exclusive and fix various
mdoc formatting nits.

PR:		57027
Approved by:	simon
Obtained from:	OpenBSD
2003-10-03 00:44:11 +00:00