Commit Graph

64 Commits

Author SHA1 Message Date
joerg 06c042e9bc Plug a memory leak. From Igor Zinovik. 2010-01-10 01:10:16 +00:00
joerg 6e3add81a1 Do not try to mmap a zero length file. 2009-10-21 17:16:11 +00:00
joerg 57b5269dad Explicitly include fcntl.h for O_CREAT to not depend on namespace
pollution.
2009-06-05 19:55:43 +00:00
lukem d96ab870e3 Attempt to fix previous to address a coredump. 2009-04-18 03:25:34 +00:00
lukem 1e4c32c4f5 Fix sign-compare issue 2009-04-13 00:07:26 +00:00
joerg 7e69823738 Don't workaround ancient macro argumentent limitation with .Xo/.Xc. 2009-03-10 13:57:08 +00:00
joerg d5b2c9a825 Update patch to the version used by DragonFly and derived from OpenBSD.
Major changes are:
- better detection of double applied patches
- rejects remain unified diffs for unified patches
- far less limitations, e.g. patch lines may be arbitrary long

This addresses PR standards/11220 by changing patch -b behavior to be
POSIX compliant. Old behavior can be obtained using --suffix, which
works since NetBSD 1.4. pkgsrc has been adjusted accordingly.
2008-09-19 18:33:34 +00:00
gdt 69bdd817cc Add error checking to use of fputs in creating output file in
temprorary directory.  Previously, fputs was used without checking the
return value, leading to silent truncation when the temporary
filesystem was full (such as can easily happen when migrating to
tmpfs).
2008-08-10 22:36:23 +00:00
lukem bd560fde31 Convert to using raise_default_signal(3). 2007-10-14 04:54:34 +00:00
christos 1e1f0dd3ab PR/34627: Lubomir Kundrak: patch(1) segfaults, when fed from stdin in batch
or force mode
2006-09-26 16:36:07 +00:00
christos 04e2c897d2 Coverity CID 3510: Don't leak memory. 2006-05-24 16:43:35 +00:00
christos bd21f84917 Coverity CID 1253, 1254: Don't assign the return of read or write to size_t.
It will never be negative.
2006-04-09 19:12:17 +00:00
christos f5a5211062 It is silly to creat() and close a file just to stat it. open/fstat/close
instead checking for errors. From Coverity CID 1276.
2006-04-09 19:06:34 +00:00
christos 5800a5519e Coverity CID 2078, 2079, 2080: Plug memory leaks. 2006-04-09 19:03:32 +00:00
wiz de60b309dc Sort options. Add -C to usage. 2005-03-25 23:55:02 +00:00
wiz eb0439126c Fix typo and drop trailing whitespace. 2005-03-25 23:49:28 +00:00
skd 4f9669ed8d add --dry-run like gnu patch. 2005-03-25 23:00:55 +00:00
mycroft 33131ab95f Fix an array overrun in option parsing.
Fixes PR 26732, PR 26775, PR 28416 and PR 28589.
2004-12-09 18:06:10 +00:00
dsl 58d3abc94f Add (unsigned char) cast to ctype functions
Stop infinite loop if get lower case char with no upper case equiv.
2004-10-30 21:52:09 +00:00
cube 224d89c7db Remove debug printf (hi mycroft!). 2004-08-14 12:53:35 +00:00
mycroft ee776b9f85 Parse multiple options that are specified together; e.g. "-fs".
XXX It is not clear to me why patch(1) doesn't get getopt_long(3).
2004-08-06 14:54:26 +00:00
itojun 38b27406f9 remove unused macros 2003-07-30 08:51:55 +00:00
itojun 75c32b46eb use bounded string op 2003-07-30 08:51:04 +00:00
itojun c0970755a6 pedantic check around unsafe strncpy.
XXX this code needs a serious rewrite
2003-07-12 13:53:08 +00:00
itojun ef4b3d620c copyright missing in files, copy them from README 2003-07-12 13:47:42 +00:00
kristerw 3e51d2b759 Const poisoning. 2003-07-08 01:55:35 +00:00
kristerw 158e4448b0 Shorten long lines.
Some whitespace changes to get closer to KNF.
2003-06-01 22:04:29 +00:00
kristerw f4b0e187e9 Fix some lint warnings. 2003-05-30 23:08:12 +00:00
kristerw 7e5434fe39 Remove stuff that are not needed any longer. 2003-05-30 22:33:58 +00:00
kristerw b86c323d39 Simplify handling of memory allocation, and make sure all return values
from malloc etc. are handled.

This removes the old behavior to retry the operation with a less memory-
consuming method in case malloc failed (this mechanism has never really
worked, and is hard to test.  Besides, it is less useful now than it was
20 years ago when the code was written...)
2003-05-30 18:14:13 +00:00
kristerw 2a9882e7e9 Be consistent with use of types (e.g. do not use LINENUM for quantities
that are not line numbers).
2003-05-29 00:59:23 +00:00
christos 5ca06f36e7 PR/5123: Ignatios Souvatzis: make patch exit gracefully on malformed input. 2003-04-20 19:37:08 +00:00
kristerw 6d0ebdd74a Do not try to write a rejects file for those cases where the user has
told us to skip a patch due to missing file to patch.

Solves PR 19827 from Toru TAKAMIZU.
2003-01-19 00:50:28 +00:00
wiz 1035faff1d writable, not writeable. 2003-01-06 20:30:28 +00:00
wiz e840d74cd0 Superfluous word; from jmc@prioris.mini.pw.edu.pl via openbsd. 2003-01-06 12:48:06 +00:00
grant be8ae688ae New sentence, new line. 2002-09-30 11:08:56 +00:00
kristerw f3dbc98b85 Handle patches in which diff(1) has added lines saying
"\ No newline at end of file"
2002-03-24 01:56:20 +00:00
kristerw ec7291ab70 Don't leak memory if realloc fails
Spell "FALLTHROUGH" correctly
2002-03-16 23:55:02 +00:00
kristerw 93318b47b3 Check result of malloc and strdup
Made some functions static
Removed unneccessary buffer
Increased size of some buffers that could overflow
2002-03-16 22:36:42 +00:00
kristerw 774d6dd9e1 KNF 2002-03-15 19:44:54 +00:00
kristerw 2b96113ff9 KNF 2002-03-11 23:29:02 +00:00
kristerw dbe85b35bd Remove obsolete files. 2002-03-11 18:57:50 +00:00
kristerw 175b5054de Ansify
Remove unused defines
Remove #ifndef lint
Remove redundant and incorrect casts.
2002-03-11 18:47:51 +00:00
kristerw 8bcbaa7bc8 Ansify
Remove 'register'
Make local functions static.
Remove most '#ifndef lint'
2002-03-08 21:57:33 +00:00
ragge 744110b40b License change; patch.c now has a BSD license.
From Larry Wall via Niklas Hallqvist, <niklas@appli.se>.
2002-03-06 12:01:03 +00:00
ross 2a76afae02 Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:36:18 +00:00
wiz aded0d2cce Whitespace cleanup. 2001-12-01 16:43:07 +00:00
kleink 961cdd38dd Support the 1003.2-92 -i option to specify a patchfile;
fixes PR standards/11221.
2000-10-16 07:05:04 +00:00
is 135600f947 More format string cleanup by sommerfeld. 2000-10-11 14:46:00 +00:00
sommerfe 141aa9e579 Fix PR2429: catch doubly-applied patches which create new files. 1999-02-09 05:15:45 +00:00