Commit Graph

7 Commits

Author SHA1 Message Date
Alan Somers
809a8352dd Drop "All rights reserved" from the files I own
Also, add SPDX tags where needed.

MFC after:	2 weeks
2019-03-11 22:23:56 +00:00
Alan Somers
d23662ec2e tail: fix "tail -r" for piped input that begins with '\n'
A subtle logic bug, probably introduced in r311895, caused tail to print the
first two lines of piped input in forward order, if the very first character
was a newline.

PR:		222671
Reported by:	Jim Long <freebsd-bugzilla@umpquanet.com>, pprocacci@gmail.com
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2018-02-19 22:09:49 +00:00
Bryan Drewery
3806950135 DIRDEPS_BUILD: Connect new directories.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:04:07 +00:00
Enji Cooper
71607cbea7 Unbreak :broken_pipe
- Capture exit code in pipeline and test in output.
- Drop awk use in favor of `sleep 2`. This helps guarantee the EPIPE
  behavior without the potential race.
2017-09-09 06:24:21 +00:00
Enji Cooper
7c69f31eb6 Check result of seq call and save output via atf_check -o
This ensures that seq outputting to ints will not fail as silently if there's
an error.
2017-09-09 05:50:47 +00:00
Conrad Meyer
b2b1603e17 tail(1): Do not print bogus errno string
In the case where write(2) does not return -1, it does not initialize errno.
This can happen when a broken pipe causes a short write.

I attempted to adapt the submitted test case to ATF but could not figure out
how to make the test run in the ATF environment.  So the aborted test is
left disabled, in case someone would like to run it manually or fix it.

PR:		221976
Submitted by:	<martin AT lispworks.com> (earlier version)
Sponsored by:	Dell EMC Isilon
2017-09-01 22:37:49 +00:00
Alan Somers
cdb7a6fc42 Fix memory leaks during "tail -r" of an irregular file
* Rewrite r_buf to use standard tail queues instead of a hand-rolled
  circular linked list. Free dynamic allocations when done.
* Remove an optimization for the case where the file is a multiple of 128KB
  in size and there is a scarcity of memory.
* Add ATF tests for "tail -r" and its variants.

Reported by:	Valgrind
Reviewed by:	ngie
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D9067
2017-01-10 20:43:32 +00:00