Commit Graph

12429 Commits

Author SHA1 Message Date
Edward Tomasz Napierala
806ea85ac5 Make iscsictl(8) error messages more consistent.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-31 07:49:59 +00:00
Bryan Drewery
31dd9effd9 Fix with external GCC after r300886.
Somehow the /usr/include path got lost in this particular case.
Just pass it along from --sysroot as was already done for
DIRDEPS_BUILD.

Sponsored by:	EMC / Isilon Storage Division
2016-05-29 01:15:15 +00:00
Edward Tomasz Napierala
54fc4636f3 Do libxo cleanup even in case of errors.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-26 14:21:02 +00:00
Edward Tomasz Napierala
aa63d825a7 Make iscsictl(8) actually report non-zero status on errors. The "failed"
is negative, because the error returned from calls to ioctl(2) is negative.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-26 14:19:24 +00:00
Ed Schouten
09a113491c Make code compile when basename() is POSIX compliant.
In addition to the previous change I made to ar.c, pull in another
basename() related fix. This change is similar to the one made to the
ELF Toolchain version of ar, with the difference that the ELF Toolchain
version lacks error handling for the strdup() call.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D6467
2016-05-26 13:49:40 +00:00
Don Lewis
243e928310 Avoid buffer overflow when copying the input file name and appending .dat.
Check the return value from fread() to be sure that it was successful.

Reported by:	Coverity
CID:		1006709, 1009452
MFC after:	1 week
2016-05-26 01:33:24 +00:00
Pedro F. Giffuni
924b84c108 sed: convert sed to use REG_STARTEND more explicitly.
Summarizing the findings in the OpenBSD list:

This solves a reproduceable issue with very recent Mesa where REG_NOTBOL
combined with a match at the begin of the string causes our regex library
to treat the word as not begin of word.

Thanks to Martijn van Duren and Ingo Schwarze for taking the time to
solve this in the least invasive way.

PR:		209352, 209387
Taken from:     openbsd-tech (Martijn van Duren)
MFC after:	1 month
2016-05-25 15:42:39 +00:00
Tony Finch
751af43e1c Send whois queries for gov.uk names to JANET. 2016-05-25 13:09:06 +00:00
Enji Cooper
0e80f25894 Fix humanized decoding of struct stat with respect to .st_mtim
st_mtim was being incorrectly described as "stime=", not "mtime=". This was
introduced with the original feature commit (r176471).

MFC after: 1 week
PR: 209699
Submitted by: naddy
Sponsored by: EMC / Isilon Storage Division
2016-05-22 18:20:45 +00:00
Kenneth D. Merry
f4bf2442a0 Add the density code for LTO-7 to libmt and the mt(1) man page.
The density code and bits per mm values were obtained from an
actual drive density report.

The number of tracks were obtained from an LTO-7 hardware
announcement on IBM's web site.

Sponsored by:	Spectra Logic
MFC after:	3 days
2016-05-20 19:30:52 +00:00
Simon J. Gerraty
e48f47ddc1 Merge bmake-20160512 2016-05-20 17:35:39 +00:00
Ed Schouten
c76f604ee9 Make code compile when basename() is POSIX compliant.
If basename() uses "char *", we shouldn't do the intermediate
assignment, as that field is of type "const char *". Simply call
basename() on the command line argument directly.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D6463
2016-05-19 20:03:01 +00:00
Eitan Adler
cef367e6a1 Don't repeat the the word 'the'
(one manual change to fix grammar)

Confirmed With: db
Approved by: secteam (not really, but this is a comment typo fix)
2016-05-17 12:52:31 +00:00
Don Lewis
b74e373971 swprintf() and apparently wcsftime() want the their output buffer size
specified in terms of the the number of wide characters and not
sizeof(buffer).

Reported by:	Coverity
CID:		1007605, 1007606
MFC after:	1 week
2016-05-17 05:05:30 +00:00
Simon J. Gerraty
9d0fa50eed Use != 0 to be clear 2016-05-17 00:27:18 +00:00
Simon J. Gerraty
0d2181d9ac Allow -f - to read from stdin. 2016-05-17 00:08:43 +00:00
Don Lewis
d2c82c0cfe Fix off by one error that overflowed the rep_len array when doing
the final NUL termination.

Reported by:	Coverity
CID:		1007617
MFC after:	1 week
2016-05-16 19:48:02 +00:00
Don Lewis
4b426307e5 Increase size of argv[] array to avoid running off the end.
Reported by:	Coverity
CID:		1193819
MFC after:	1 week
2016-05-16 16:01:46 +00:00
Jilles Tjoelker
dd53735797 install: Revert utimensat usage (r299850).
This should fix the build on older stable/10, since install is a bootstrap
tool.

Pending a decision how to fix this properly, revert utimensat usage. Copies
with the -p option will again appear older than the original almost always,
but -p is not commonly used.
2016-05-16 12:56:28 +00:00
Marcelo Araujo
26d0a72296 Use NULL instead of 0 for pointers.
MFC after:	2 weeks
2016-05-16 01:11:02 +00:00
Jilles Tjoelker
ecaa1101c3 install: When preserving timestamps, also copy the nanoseconds part. 2016-05-15 13:17:05 +00:00
Don Lewis
090fc1c839 Always return either a dynamically allocated string or NULL from
expand().  Never return the name parameter, which could be a the buf[]
buffer which is allocated on the stack by getdeadletter() and which
would then be used after getdeadletter() has returned.

Reported by:	Coverity
CID:		1199383
MFC after:	1 week
2016-05-13 06:15:05 +00:00
Don Lewis
e4efa066e1 Instead of ignoring the EEXIST from link(), unconditionally unlink
the terget before calling link().  This should prevent links to an
old copy of the file from being retained.
2016-05-13 05:49:02 +00:00
Don Lewis
16a9eab953 Simplify some overly complex code so that both humans and Coverity
have a better chance of understanding it.

Reported by:	Coverity
CID:		1009684, 1006931
2016-05-13 00:50:53 +00:00
Don Lewis
52af39633a If fchdir() fails, call err() instead of warn(). 2016-05-12 23:37:58 +00:00
Don Lewis
3694294ca5 Avoid Coverity NUL termination warning about strncpy() by using
memcpy() instead.  It's probably a bit more optimal in this case
anyway. [1]

The program logic leading up to the creation of the strncpy/memcpy
destination buffer is a bit hairy.  Add a call to assert() to make
it clear what is happening here and detect any potential buffer
overruns in the future.

Check a couple syscall error returns.  Ignore the EEXIST error from
link() to preserve existing behavior. [2] [3]

Reported by:	Coverity
CID:		1009659 [1], 1009349 [2], 1009350 [3]
2016-05-12 23:14:31 +00:00
Martin Matuska
cdf63a700c MFV r299425:
Update libarchive to 3.2.0

New features:
- new bsdcat command-line utility
- LZ4 compression (in src only via external utility from ports)
- Warc format support
- 'Raw' format writer
- Zip: Support archives >4GB, entries >4GB
- Zip: Support encrypting and decrypting entries
- Zip: Support experimental streaming extension
- Identify encrypted entries in several formats
- New --clear-nochange-flags option to bsdtar tries to remove noschg and
  similar flags before deleting files
- New --ignore-zeros option to bsdtar to handle concatenated tar archives
- Use multi-threaded LZMA decompression if liblzma supports it
- Expose version info for libraries used by libarchive

Patched files (fixed compiler warnings):

contrib/libarchive/cat/bsdcat.c (vendor PR #702)
contrib/libarchive/cat/bsdcat.h (vendor PR #702)
contrib/libarchive/libarchive/archive_read_support_format_mtree.c (PR #701)
contrib/libarchive/libarchive_fe/err.c (vendor PR #703)

MFC after:	1 month
Relnotes:	yes
2016-05-12 10:16:16 +00:00
Don Lewis
dc77866517 Use strlcpy() instead of strncpy() when copying date and subj
to ensure that these are properly NUL terminated since they
are passed to printf().

Reported by:	Coverity
CID:		974770
MFH:		1 week
2016-05-12 08:55:57 +00:00
Don Lewis
1f12a67942 Use strlcpy() instead of strncpy() when copying the encoding value
to ensure that the destination is NUL terminated.  Length truncation
of one more character should not be an issue since encoding values
that long are not supported by libc.  The destination string is
treated as a NUL terminated string, but it is only passed to strcmp()
for comparison to a set of shorter, fixed length strings, so this
is not a serious problem.

Reported by:	Coverity
CID:		974769
MFC after:	1 week
2016-05-12 08:41:22 +00:00
Conrad Meyer
1d1694a73b rpcgen(1): Tag crash() routine as __dead2 for static analyzers
Suggested by:	Coverity
CID:		1305464
Sponsored by:	EMC / Isilon Storage Division
2016-05-12 03:49:05 +00:00
Pedro F. Giffuni
59009de8e9 chat(8): use NULL instead of zero for initializing a pointer. 2016-05-12 02:02:16 +00:00
Conrad Meyer
7bfdbca596 random(6): Fix double-close
In the case where a file lacks a trailing newline, there is some "evil" code to
reverse goto the tokenizing code ("make_token") for the final token in the
file.  In this case, 'fd' is closed more than once.  Use a negative sentinel
value to guard close(2), preventing the double close.

Ideally, this code would be restructured to avoid this ugly construction.

Reported by:	Coverity
CID:		1006123
Sponsored by:	EMC / Isilon Storage Division
2016-05-11 22:04:28 +00:00
Conrad Meyer
c24375a7de whois(1): Fix potential double-close and logic mistakes
Close the fd the poll error was detected on, rather than the last opened fd, to
fix the double-close.

Use -1 to make it explict which int variables no longer own socket file
descriptors.

Actually shrink, rather than grow, the poll timeout to match comment.

Reported by:	Coverity
CID:		1304860, 1305616
Sponsored by:	EMC / Isilon Storage Division
2016-05-11 18:03:51 +00:00
Conrad Meyer
68c47fcfad whois(1): Pull out async multiple host connection code into a routine
This logic was added to the whois() function in r281959, but could easily be
its own routine.  In this case, I think the abstraction makes both functions
easier to reason about.

This precedes some Coverity-suggested cleanup.

Sponsored by:	EMC / Isilon Storage Division
2016-05-11 17:52:06 +00:00
Conrad Meyer
6a4b635383 Fix buffer overrun in gcore(1) NT_PRPSINFO
Use size of destination buffer, rather than a constant that may or may not
correspond to the source buffer, to restrict the length of copied strings.  In
particular, pr_fname has 16+1 characters but MAXCOMLEN is 18+1.

Use strlcpy instead of strncpy to ensure the result is nul-terminated.  This
seems to be what is expected of these fields.

Reported by:	Coverity
CIDs:		1011302, 1011378
Sponsored by:	EMC / Isilon Storage Division
2016-05-11 15:31:31 +00:00
Conrad Meyer
a60711fd00 sdiff(1): Fix potential NULL deref in cleanup path
In the presence of the --diff-pid argument, it is possible for 'diffpipe' to be
NULL.  Only fclose() it if it was initialized.

Reported by:	Coverity
CID:		1355183
Sponsored by:	EMC / Isilon Storage Division
2016-05-10 20:09:40 +00:00
Pedro F. Giffuni
6351d60947 sed.1: Correction for the case insensitive case.
Use the capital I instead of the lowercase.

Submitted by:	Mikhail T.
PR:		195929
MFC after:	2 weeks
2016-05-10 17:01:51 +00:00
Baptiste Daroussin
68dd67a27b Rename getline with get_line to avoid collision with getline(3)
When getline(3) in 2009 was added a _WITH_GETLINE guard has also been added.
This rename is made in preparation for the removal of this guard
2016-05-10 11:17:36 +00:00
Baptiste Daroussin
f03ef8405b Rename getline with get_line to avoid collision with getline(3)
When getline(3) in 2009 was added a _WITH_GETLINE guard has also been added.
This rename is made in preparation for the removal of this guard
2016-05-10 11:12:31 +00:00
Baptiste Daroussin
a651f2bc6c Rename getline with get_line to avoid collision with getline(3)
When getline(3) in 2009 was added a _WITH_GETLINE guard has also been added.
This rename is made in preparation for the removal of this guard

Obtained from:	NetBSD
2016-05-10 11:11:23 +00:00
Pedro F. Giffuni
11398c77da Revert r299279:
Simplify redundant malloc'ing in sed -e.

It is causing havoc in the ports tree:

===>  Configuring for wxsvg-1.5.7
sed: 1: "/gcc_dir=\\`/s/gcc /$CC /": bad flag in substitute command: '/'
*** Error code 1

===>  Patching for vips-8.3.1
sed: 1: "1s|^#![[:space:]]*/usr/ ...": bad flag in substitute command: 's'
*** Error code 1

PR:		195929
Reported by:	danilo
2016-05-10 02:02:50 +00:00
Bryan Drewery
29df9f6b75 DIRDEPS_BUILD: Run the staged bootstrap-tools version of build-tools.
This avoids running target binaries.

Sponsored by:	EMC / Isilon Storage Division
2016-05-09 22:21:09 +00:00
Baptiste Daroussin
fe5870b6c7 Rationalize license numbering 2016-05-09 20:55:35 +00:00
Baptiste Daroussin
d819303ada Some style(9) fixes
No functional changes

Obtained from:	OpenBSD
2016-05-09 20:55:00 +00:00
Ben Woods
8dd5aa946f Add myself (woodsb02) to the calendar.freebsd file
Approved by:	adamw (mentor)
Differential Revision:	https://reviews.freebsd.org/D6276
2016-05-09 20:21:49 +00:00
Pedro F. Giffuni
d74b9e1311 Simplify redundant malloc'ing in sed -e.
When encountering an -e argument, sed currently mallocs a string to COPY
the optarg -- with '\n' appended. The appendage does not seem necessary --
indeed, the same call to add_compunit processing the sole command (given
without -e) passes the *argv verbatim: without making a copy, and without
appending newline.

This matches what is done in other BSDs.

Submitted by:	Mikhail T.
PR:		195929
MFC after:	2 weeks
2016-05-09 18:53:46 +00:00
Jilles Tjoelker
1f9b8f8e0d install: Add some tests. 2016-05-08 21:11:24 +00:00
Baptiste Daroussin
dbc0cf500d Only one program is build in usr.bin/sdiff use the right include 2016-05-07 20:23:26 +00:00
Baptiste Daroussin
1ddda798a6 Revert r299218 VISUAL is actually a perfecly valid env to specify an editor 2016-05-07 18:58:07 +00:00
Baptiste Daroussin
041db57684 Only use EDITOR as a variable to specify which text editor to use 2016-05-07 18:48:48 +00:00
Baptiste Daroussin
15eaa1aea0 Directly call the editor if needed instead of spawning /bin/sh 2016-05-07 18:44:30 +00:00
Baptiste Daroussin
0c4ac56e16 Replace fparseln(3) with getline(3)
It removes a dependency on libutil.
2016-05-07 18:21:58 +00:00
Pedro F. Giffuni
b6f5aa5715 sed: rewrite the main loop.
Rewrite the main loop of the "sed s/..." command, shortening it by ten
lines and simplifying it by removing the switch statement implementing
/g, /1, and /2 separately and repetitively.

This will be needed to bring a fix from OpenBSD later.

Obtained from:	OpenBSD (schwarze CVS Rev. 1.18)
MFC after:	3 weeks
2016-05-07 01:44:22 +00:00
Edward Tomasz Napierala
b0b3f0e152 Add the "-r" flag to iscsictl(8).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-06 13:45:42 +00:00
Edward Tomasz Napierala
6735d50255 Document the "Protocol" field of iscsi.conf(5).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-06 13:44:56 +00:00
Enji Cooper
430f7286a5 Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed
after r298107

Summary of changes:

- Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that
  namespacing is kept with FILES appropriately, and that this shouldn't need
  to be repeated if the namespace changes -- only the definition of PACKAGE
  needs to be changed
- Allow PACKAGE to be overridden by callers instead of forcing it to always be
  `tests`. In the event we get to the point where things can be split up
  enough in the base system, it would make more sense to group the tests
  with the blocks they're a part of, e.g. byacc with byacc-tests, etc
- Remove PACKAGE definitions where possible, i.e. where FILES wasn't used
  previously.
- Remove unnecessary TESTSPACKAGE definitions; this has been elided into
  bsd.tests.mk
- Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES;
  ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk.
- Fix installation of files under data/ subdirectories in lib/libc/tests/hash
  and lib/libc/tests/net/getaddrinfo
- Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup)

Document the proposed changes in share/examples/tests/tests/... via examples
so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of
replacing FILES. share/mk/bsd.README didn't seem like the appropriate method
of communicating that info.

MFC after: never probably
X-MFC with: r298107
PR: 209114
Relnotes: yes
Tested with: buildworld, installworld, checkworld; buildworld, packageworld
Sponsored by: EMC / Isilon Storage Division
2016-05-04 23:20:53 +00:00
Bryan Drewery
0252c68ba4 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	EMC / Isilon Storage Division
2016-05-04 03:14:34 +00:00
Baptiste Daroussin
eebea334c4 Print the fchmodat mode in human readable fashion
MFC after:	1 week
2016-05-03 21:27:17 +00:00
Bjoern A. Zeeb
e29c552990 fgetc returns an int not a char.
Found by:   powerpc builds failing due to comparing with EOF raised:
"comparison is always false due to limited range of data type"
2016-05-02 15:07:43 +00:00
Pedro F. Giffuni
af7ca7c85d usr.bin: minor spelling fixes on comments.
No functional change.
2016-05-01 16:13:05 +00:00
Pedro F. Giffuni
fcc7baa1ae localedef(1): minor spelling fixes on comments.
No functional change.
2016-05-01 16:10:56 +00:00
Ed Schouten
e33d251e8e Remove useless calls to basename().
There are a couple of places in the source three where we call
basename() on constant strings. This is bad, because the prototype
standardized by POSIX allows the implementation to use its argument as a
storage buffer.

This change eliminates some of these unportable calls to basename() in
cases where it was only added for cosmetical reasons, namely to trim
argv[0]. There's nothing wrong with setting argv[0] to the full path.

Reviewed by:	jilles
Differential Revision:	https://reviews.freebsd.org/D6093
2016-05-01 08:22:11 +00:00
Baptiste Daroussin
da5c2c4230 When checking for binary file, check if ch is not EOF only ch actually got
a value assigned

Reported by:	pfg
2016-04-30 14:48:30 +00:00
Dimitry Andric
4c4924e8b0 Update from subversion 1.9.2 to 1.9.4.
This contains only bug fixes, no new features.  The repository format is
also unchanged from 1.9.2.  Full list of changes between 1.9.4 and
earlier versions:

  https://svn.apache.org/repos/asf/subversion/tags/1.9.4/CHANGES

Note that the two security issues fixed in 1.9.4 (CVE-2016-2167 and
CVE-2016-2168) do not affect the version of Subversion in the FreeBSD
base system, since neither SASL nor Apache modules are enabled.

Relnotes:	yes
MFC after:	2 weeks
2016-04-30 10:35:42 +00:00
Baptiste Daroussin
13b5b54865 import sdiff(1) from GSoC 2012
Import sdiff(1) from the diff version written by Raymond Lai,
improved during GSoC 2012 by Jesse Hagewood.

Compared to the version done in during that summer of code:
- Remove the zlib frontend: zsdiff
- Compatible output (column size and separators) with GNU sdiff

Compared to GNU sdiff in ports:
- The only difference is padding using spaces vs tabs

Compared to OpenBSD and NetBSD import:
- Implement missing options (including long options) from GNU sdiff
- Improved support for the edition mode (signal handling)
- Output visually compatible with GNU sdiff: size of columns

While here import regression tests from NetBSD adapted to fit the output as
expected by GNU sdiff

Reviewed by:	emaste (in part)
Obtained from:	OpenBSD, NetBSD, GSoC 2012
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D5981
Differential Revision:	https://reviews.freebsd.org/D6032 (diff with NetBSD version)
Differential Revision:	https://reviews.freebsd.org/D6033 (diff with OpenBSD version)
2016-04-29 23:27:15 +00:00
Glen Barber
49dae58b28 Fix including Kyuafile in packaged base system.
Fix a related typo while here.

Note, this change results in the Kyuafile inclusion in the runtime
package, which needs to be fixed, however addresses the PR as far
as I can tell in my tests.

PR:		209114
Submitted by:	ngie
Sponsored by:	The FreeBSD Foundation
2016-04-29 05:28:40 +00:00
Pedro F. Giffuni
0b33b55b01 Small typo. 2016-04-28 15:20:08 +00:00
Marcelo Araujo
cd59e2f343 Use MIN() macro from sys/param.h.
MFC after:	2 weeks.
2016-04-27 02:44:10 +00:00
Marcelo Araujo
a9a46bd918 Use MIN() macro from sys/param.h.
MFC after:	2 weeks.
2016-04-27 02:34:25 +00:00
Marcelo Araujo
1e8b591f62 Use macro MIN() from sys/param.h.
MFC after:	2 weeks.
2016-04-27 02:26:31 +00:00
Marcelo Araujo
a301044615 Use MIN() macro from sys/param.h.
MFC after:	2 weeks.
2016-04-27 02:13:57 +00:00
Marcelo Araujo
5d49c30c7b Use MIN() instead of MAX() as the previous syntax was wrote in a weird and
confused way: "prec > 9 ? 9 : prec".

Submitted by:	pfg, ngie and luke <luke.tw@gmail.com>
MFC after:	2 weeks.
2016-04-26 00:29:00 +00:00
Tony Finch
c37dc1fb0b Example RIPE whois query with options and spaces.
Since it is used in the example, mention the -- option in the synopsis
even though it is a universal standard, and tweak to fit it on one line.
2016-04-25 15:46:42 +00:00
Bjoern A. Zeeb
d654df1365 Try to make gcc builds happy again by removing a redundant declaration. 2016-04-25 13:20:35 +00:00
Pedro F. Giffuni
3548708c47 Adjust a type from r267490.
Independent of the maximum length, the return type for strnlen(3)
is always size_t.
2016-04-24 04:28:04 +00:00
Pedro F. Giffuni
2c4eed4723 patch(1): avoid signed integer overflow when debugging.
Integer i is used to index p_end of type LINENUM (actually long).

Match the types.

MFC after:	5 days
2016-04-24 04:08:36 +00:00
Maxim Sobolev
96ad8686f6 GC duplicate define. 2016-04-23 07:28:32 +00:00
Maxim Sobolev
4fc55e3e46 Improve performance in a few key areas:
o Split the compression across several worker threads. By default, "several"
   matches number of CPUs, capped at 24 for sanity when running on a very big
   hardwares. Provide option to set that number manually;

 o Fix bug inherited from the mkulzma (R.I.P) which degraded already slow LZMA
   compression even further by calling function to release compression state
   after processing each block.

   It is neither documented as required nor actually required by the LZMA
   library. This caused spree of system calls to release memory and then map
   it again for every block. LZMA compression is more than 2x faster after this
   change alone;

 o Record time it takes to do compression and report throughput achieved.

 o Add simple first-level 256 entry hash table for de-dup code, so it's not
   becoming a bottleneck at big files.
2016-04-23 07:23:43 +00:00
Marcelo Araujo
61cfb5db60 Use roundup2() macro from sys/param.h.
MFC after:	2 weeks.
2016-04-22 06:23:23 +00:00
Marcelo Araujo
ee03c16e64 Use MIN() macro from sys/param.h.
MFC after:	2 weeks.
2016-04-22 03:46:57 +00:00
Marcelo Araujo
cadc2836d8 Use macro MAX() from sys/param.h.
MFC after:	2 weeks.
2016-04-22 03:43:06 +00:00
Marcelo Araujo
fcc0131f63 Use macro MAX() from sys/param.h.
MFC after:	2 weeks.
2016-04-22 03:37:27 +00:00
Pedro F. Giffuni
e55a6575d9 kernel: use our nitems() macro when it is available through param.h.
No functional change, only trivial cases are done in this sweep,

Discussed in:	freebsd-current
2016-04-21 21:30:51 +00:00
Ed Maste
2821bdccaa elftoolchain: Use ${SRCTOP} for the top of the FreeBSD tree
It's provided by sys.mk so there's no need to derive it from ${.CURDIR}.

Suggested by:	ngie
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D5998
2016-04-21 12:58:29 +00:00
Eitan Adler
c706c470e4 Bring a little more compability with GNU units 2.12
- notionally support a 'history file' flag. This doesn't do much now,
  but is there to prevent scripts written against GNU units from
  breaking
- correctly gracefully quit rather than exit (this will make it easier
  to support a history file in the future)
- remove the "t" flag from fopen which was there to support windows. We
  have not supported windows since at the latest, the introduction of
  capsicum.
2016-04-21 05:24:47 +00:00
Baptiste Daroussin
e6d8c0e2dd Plug memory leaks
Reported by:	Coverity
CID=		1338535, 1338536, 1338542, 1338569, 1338570
2016-04-20 21:23:42 +00:00
Baptiste Daroussin
c1eac826c2 Fix bad checking of the return of realloc(3)
Reported by:	Coverity
CID:		1007335
MFC after:	3 days
2016-04-20 20:56:06 +00:00
Baptiste Daroussin
89afcfedb6 Fix typo: actually test the return of strchr(3)
Reported by:	Coverity
CID:		1007335
MFC after:	3 days
2016-04-20 20:54:47 +00:00
Marcelo Araujo
6b1c46441c Partially revert the change on r298325 where there is an
(-1) casted to a pointer.

Submitted by:	pfg
MFC after:	2 weeks.
2016-04-20 01:38:54 +00:00
Marcelo Araujo
b4b3d271de Use NULL instead of 0 for pointers.
Small cosmetic change.

MFC after:	2 weeks.
2016-04-20 01:28:31 +00:00
Marcelo Araujo
61c2ed541d Use NULL instead of 0 for pointers.
gethostbyname(3) will return NULL for error status.

MFC after:	2 weeks.
2016-04-20 01:26:03 +00:00
Xin LI
aa9ddbd03e Fix build breakage introduced by r298253. 2016-04-19 07:28:39 +00:00
Eitan Adler
3851177de0 Rename units.lib -> definitions.units
- this matches GNU units 2.12
add ISO country codes from units 2.12
2016-04-19 05:17:59 +00:00
Eitan Adler
8ae87993ed Remove pathnames.h
- it only holds a single constant
- it doesn't exist in the GNU variant
2016-04-19 05:04:39 +00:00
Marcelo Araujo
c81a92db98 Use NULL instead of 0 for pointers.
realloc will return NULL in case it cannot allocate memory.

MFC after:	2 weeks.
2016-04-19 02:05:32 +00:00
Marcelo Araujo
7a4b1114b1 Use NULL instead of 0 for pointers.
strchr(3) will return NULL if the character does not appear in the
string.

MFC after:	2 weeks.
2016-04-18 14:44:01 +00:00
Ed Maste
c0e5e7f3d2 Replace ${CURDIR}/../.. with ${CURDIR:H:H} in elftoolchain
This produces a nicer path in debug info and build logs.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2016-04-18 13:13:59 +00:00
Marcelo Araujo
fffa1bd071 User NULL instead of 0 for pointers.
getservent(3) returns NULL on EOF or error.

MFC after:	2 weeks.
2016-04-18 07:14:01 +00:00
Marcelo Araujo
1b56693f8b Use NULL instead of 0 for pointers.
fopen(3) will return NULL in case it cannot open the STREAM.

MFC after:	2 weeks.
2016-04-18 07:09:34 +00:00
Marcelo Araujo
26ac9660a4 Use NULL instead of 0 for pointers.
MFC after:	2 weeks.
2016-04-18 07:05:18 +00:00