summaryrefslogtreecommitdiffstats
path: root/usr.bin/patch/patch.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Change all tame callers to namechange to pledge(2).deraadt2015-10-091-3/+3
|
* patch(1) can move to "stdio rpath wpath cpath tmppath fattr proc exec"deraadt2015-10-071-2/+2
| | | | | | | | | | | | | (adding proc exec), now that "exec" has arrived in the kernel. This permits the dangerous game of feeding ed-style diffs with popen() via /bin/ed. Shocked yet? Your mission, should you choose to accept it, is to replace this code with an builtin ed-style patcher, maybe cribbing code from ed itself. I'm sorry, but we can't fix the entire world all at once. Noone loves deprecating standarized features as much as we do, but there are some lines. Maybe if people become aware of how crappy the implimentations of some standard features are, they could help decide the path.
* remove tame "proc". it is not useful, because the "ed" diffs requirederaadt2015-10-041-2/+2
| | | | | | fork+execve, and execve is not going to become available in this fashion. ed diffs should be handled using a built-in handler, and various folks have been discussing this behind the scenes.
* As pointed out by tobiasu, ed-style patches still use popen() and executederaadt2015-10-031-2/+2
| | | | | | | | | /bin/ed. This is RETARDED. Nothing learned from the last year? Add tame "proc" until that is fixed, to allow fork+exec. I beg for someone to cross-link the guts of ed directly into patch, or write a ed-subset which can do the job.
* patch appears to work fully with tame "stdio rpath wpath cpath tmppath fattr".deraadt2015-10-031-1/+4
| | | | | | in case of exploitation, no more network access, fork, execve, etc. I wonder if we could use whitepath lists here - if it is reasonable to limit operation in directories known early on?
* The function savestr allows NULL return values during Plan A patching so intobias2014-12-131-8/+8
| | | | | | case of out of memory conditions, Plan B can step in. In many cases, NULL value is not properly handled, so use xstrdup here (it's outside Plan A/B patching, which means that even Plan B relies on successful operations).
* spacesderaadt2014-12-081-3/+3
|
* Prefer setvbuf() to setlinebuf() for portability; ok deraadt@millert2014-11-261-3/+3
|
* unsigned char casts for ctypederaadt2013-11-261-7/+7
| | | | ok krw
* Fix confusing patch(1) output on failure when using -C. Frommillert2012-05-151-8/+7
| | | | dragonflybsd via Loganaden Velvindron. OK mikeb@ and deraadt@
* Send normal output to stdout instead of everything to stderr. Thisray2010-07-241-5/+3
| | | | | | | | | | is currently done in the latest versions of GNU patch. Please watch out for output appearing out-of-order. Discussed with millert and deraadt. OK deraadt
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-271-5/+1
| | | | | | | unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
* If no patch can be found in input, in addition to complaining on stderr,stsp2009-04-051-2/+10
| | | | | | | | have the exit code indicate failure, not success. Discrepancy with GNU patch pointed out by Arfrever Frehtes Taifersar Arahesis. Help from and ok djm@, "sounds good to me" millert@
* The code to detect multiple applied diffs to empty files I introduced 4otto2008-08-201-9/+3
| | | | | | years ago is not correct if the diff has an empty context for other reasons, so revert that change. Problem found by Joerg Sonnenberger; ok tedu@ millert@
* adds a detailed synopsis to the man page; sorts options insobrado2007-04-181-5/+6
| | | | | | | | the description list and adds missing arguments; syncs usage() written with a lot of useful advice by jmc@ ok by jmc@
* type police and assorted cleanup. From Lionel Fourquaux; ok ray@otto2006-03-111-3/+3
|
* Write reject file in unified format if the original diff was inotto2004-11-191-4/+84
| | | | | unified format. ok deraadt@
* remove unused variablederaadt2004-09-141-4/+3
|
* Properly detect if a patch already has been applied, even if thereotto2004-07-091-2/+17
| | | | | | are no eols at eofs involved. Tested by quite some people. ok deraadt@
* Unbreak handling of standard diffs (which have an empty context).otto2004-06-181-4/+9
| | | | ok @millert
* Teach patch(1) to detect if a diff creating a file (or one addingotto2004-06-141-5/+5
| | | | | lines to an empty file) already has been applied; be a bit less chatty about empty contexts. Testing hshoexer@ ok millert@
* o fairly major man page reorganizationmillert2003-10-311-9/+12
| | | | | | o add --posix option for strict POSIX conformance o change filename determination to match GNU patch Tested by various people, including a full ports build by naddy@
* Do not add an extra newline at the end if the last line of the inputotto2003-08-101-15/+24
| | | | | | | file contains no newline and the diff does not touch the last line. Contributions from millert@. ok millert@ tedu@
* Warn if the diff is a context or unified diff and the contextotto2003-08-101-3/+10
| | | | | | is empty. In this case, a previously applied patch cannot be detected. ok millert@ tedu@
* - use stdbool.h instead of roll-your-own booleansotto2003-08-011-59/+58
| | | | | | | | | - fix some -Wall warnings - fix asserts: in some cases remove them, in other cases they have become Internal errors or detection of malformed patch files. - fix some free() related code ok millert@ tedu@
* Historically, patch would treat a bare -p as -p0. This contradictsmillert2003-07-311-6/+6
| | | | | POSIX and GNU patch has also removed this, so we will too. No objections on icb (no one even seemed to know about this "feature").
* Print a maximum of one invalid line number warning per patch in a patch file.otto2003-07-311-2/+4
| | | | | | Thanks to espie@ for spotting the problem. ok millert@ henning@ espie@
* Add POSIX -i option; tedu@ OKmillert2003-07-301-9/+19
|
* o add pathnames.hmillert2003-07-291-20/+23
| | | | | | o ignore empty TMPDIR environment variable o strip any trailing slashes from TMPDIR otto@ OK
* minor knf and cleanups; otto okderaadt2003-07-281-8/+8
|
* Be more exact on how backup files are handled.otto2003-07-281-59/+114
| | | | ok millert@ tedu@
* Make patch(1) exit value match POSIX and be consistent with diff.millert2003-07-281-9/+7
| | | | Comments and OK from otto@
* Add POSIX -b option but don't change the default beahvior wrt backupsmillert2003-07-251-10/+28
| | | | yet. The old -b option is now -z (matches GNU patch).
* New version of invalid line number fix. Passes patch(1) regressions.otto2003-07-231-7/+16
| | | | ok millert@ deraadt@
* Make rejname[] static to patch.c and crank its size to NAME_MAX+1millert2003-07-221-3/+8
|
* Use getopt_long() to parse options instead of rolling our own.millert2003-07-221-204/+141
| | | | OK deraadt@ and otto@
* More cleanup.otto2003-07-221-73/+66
| | | | ok millert@ tedu@
* Back out invalid line number fix. It core dumps in some cases. Problem found byotto2003-07-211-8/+3
| | | | | marc@. ok henning@
* fix headerderaadt2003-07-211-2/+2
|
* knf and other cleanup; ok ottoderaadt2003-07-211-781/+747
|
* remove junk; ok otto teduderaadt2003-07-181-144/+126
|
* Do not produce garbage if the patch file contains invalid line numbers.otto2003-07-161-3/+8
| | | | ok millert@ tedu@
* bump randomness of mktemp to from 6 to 10 X's, as recommended by mktemp(3)avsm2003-07-021-6/+6
|
* string fixes; ok miod henningderaadt2003-04-051-20/+6
|
* 4 unchecked mallocs; cloder@acm.orgderaadt2002-07-041-2/+10
|
* patch(1) is now free, thanks Larry!niklas2002-03-051-4/+19
|
* avoid overflowsprovos1999-12-041-5/+9
|
* patch file should hold at least one patch, otherwise we're entitled toespie1999-08-311-2/+6
| | | | a diagnostic.
* add -Cespie1998-11-251-17/+28
|
* Start of -Wall and cleaning up icky bits.millert1997-09-221-2/+7
|