OpenBSD CVS

CVS log for src/usr.bin/patch/util.c


[BACK] Up to [local] / src / usr.bin / patch

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.46 / (download) - annotate - [select for diffs], Sun Oct 24 21:24:17 2021 UTC (2 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, HEAD
Changes since 1.45: +2 -2 lines
Diff to previous 1.45 (colored)

For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant.  Many developers in the past
have passed mode_t (0, 044, 0644, or such), which might lead future people
to copy this broken idiom, and perhaps even believe this parameter has some
meaning or implication or application. Delete them all.
This comes out of a conversation where tb@ noticed that a strange (but
intentional) pledge behaviour is to always knock-out high-bits from
mode_t on a number of system calls as a safety factor, and his bewilderment
that this appeared to be happening against valid modes (at least visually),
but no sorry, they are all irrelevant junk.  They could all be 0xdeafbeef.
ok millert

Revision 1.45 / (download) - annotate - [select for diffs], Mon Dec 2 22:17:32 2019 UTC (4 years, 5 months ago) by jca
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.44: +4 -4 lines
Diff to previous 1.44 (colored)

Use getline(3) to handle lines longer than 8192 bytes in patch files

Spotted by jsg@ when working on mesa.  Diff tested by sthen@ in
a partial i386 bulk.  Input from and ok jsg@ millert@

Revision 1.44 / (download) - annotate - [select for diffs], Sat Aug 17 14:25:06 2019 UTC (4 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.43: +23 -7 lines
Diff to previous 1.43 (colored)

signal handlers should not call exit() due to possibility of reentering
libc (stdio etc), instead do the unlink tasks then call _exit() instead
ok millert

Revision 1.43 / (download) - annotate - [select for diffs], Fri Jun 28 13:35:02 2019 UTC (4 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.42: +7 -7 lines
Diff to previous 1.42 (colored)

When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

Revision 1.42 / (download) - annotate - [select for diffs], Sun Dec 30 23:09:58 2018 UTC (5 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.41: +1 -2 lines
Diff to previous 1.41 (colored)

Delete unnecessary <libgen.h> #includes

ok deraadt@

Revision 1.41 / (download) - annotate - [select for diffs], Sat Apr 7 14:55:13 2018 UTC (6 years, 1 month ago) by anton
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.40: +1 -2 lines
Diff to previous 1.40 (colored)

Remove unused pathnames.h header since patch was refactoring into not invoking
ed back in 2015; ok millert@ tb@ tobias@

Revision 1.39.2.1 / (download) - annotate - [select for diffs], Mon Jul 27 16:10:54 2015 UTC (8 years, 9 months ago) by krw
Branch: OPENBSD_5_7
Changes since 1.39: +1 -25 lines
Diff to previous 1.39 (colored) next main 1.40 (colored)

Backport commit of 2015-07-26 14:32 by millert

Remove support for automatically checking files out of RCS.  The
behavior is confusing to users and even GNU patch no longer does
it by default.  OK krw@ guenther@

Revision 1.36.6.1 / (download) - annotate - [select for diffs], Mon Jul 27 16:08:18 2015 UTC (8 years, 9 months ago) by guenther
Branch: OPENBSD_5_6
Changes since 1.36: +1 -27 lines
Diff to previous 1.36 (colored) next main 1.37 (colored)

Backport commit of 2014-11-22 15:49 by tobias:
Remove SCCS support.  For this to work, we would need "get", which we don't     even have in ports.  XSI functionality of POSIX, therefore optional.

ok deraadt, schwarze, tedu

Revision 1.40 / (download) - annotate - [select for diffs], Sun Jul 26 14:32:19 2015 UTC (8 years, 9 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.39: +1 -25 lines
Diff to previous 1.39 (colored)

Remove support for automatically checking files out of RCS.  The
behavior is confusing to users and even GNU patch no longer does
it by default.  OK krw@ guenther@

Revision 1.39 / (download) - annotate - [select for diffs], Fri Jan 16 06:40:10 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE
Branch point for: OPENBSD_5_7
Changes since 1.38: +3 -4 lines
Diff to previous 1.38 (colored)

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible.  Annotate <sys/param.h> lines with their current reasons.  Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc.  Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution.  These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)

Revision 1.38 / (download) - annotate - [select for diffs], Sat Dec 13 10:31:07 2014 UTC (9 years, 5 months ago) by tobias
Branch: MAIN
Changes since 1.37: +17 -1 lines
Diff to previous 1.37 (colored)

The function savestr allows NULL return values during Plan A patching so in
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).

Revision 1.37 / (download) - annotate - [select for diffs], Sat Nov 22 15:49:28 2014 UTC (9 years, 5 months ago) by tobias
Branch: MAIN
Changes since 1.36: +3 -5 lines
Diff to previous 1.36 (colored)

Remove SCCS support.  For this to work, we would need "get", which we don't
even have in ports.  XSI functionality of POSIX, therefore optional.

ok deraadt, schwarze, tedu

Revision 1.36 / (download) - annotate - [select for diffs], Tue Nov 26 13:19:07 2013 UTC (10 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_5_BASE, OPENBSD_5_5
Branch point for: OPENBSD_5_6
Changes since 1.35: +5 -5 lines
Diff to previous 1.35 (colored)

unsigned char casts for ctype
ok krw

Revision 1.35 / (download) - annotate - [select for diffs], Sat Jul 24 01:10:12 2010 UTC (13 years, 9 months ago) by ray
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.34: +3 -3 lines
Diff to previous 1.34 (colored)

Send normal output to stdout instead of everything to stderr. This
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

Revision 1.34 / (download) - annotate - [select for diffs], Fri Jan 8 13:27:59 2010 UTC (14 years, 4 months ago) by oga
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.33: +4 -2 lines
Diff to previous 1.33 (colored)

Don't leak memory after strdup() in makedirs().

From Igor Zinovik; thanks!

ok stsp@, millert@

Revision 1.33 / (download) - annotate - [select for diffs], Tue Oct 27 23:59:41 2009 UTC (14 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.32: +1 -5 lines
Diff to previous 1.32 (colored)

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
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

Revision 1.32 / (download) - annotate - [select for diffs], Sat Mar 11 19:41:30 2006 UTC (18 years, 2 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.31: +3 -2 lines
Diff to previous 1.31 (colored)

type police and assorted cleanup. From Lionel Fourquaux; ok ray@

Revision 1.31 / (download) - annotate - [select for diffs], Mon Jun 20 07:14:06 2005 UTC (18 years, 11 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.30: +3 -6 lines
Diff to previous 1.30 (colored)

umask juggling not needed; with Lionel Fourquaux.
ok millert@ espie@

Revision 1.30 / (download) - annotate - [select for diffs], Mon May 16 15:22:46 2005 UTC (19 years ago) by espie
Branch: MAIN
Changes since 1.29: +8 -9 lines
Diff to previous 1.29 (colored)

Do not call out mkdir -p, but reuse the code from mkdir(1).

Removes the possibility of nasty stuff happening thanks to unquoted
arguments in system(1).

Also plug a small memory leak.

Problems noticed by Lionel Fourquaud.

okay millert@, deraadt@

Revision 1.29 / (download) - annotate - [select for diffs], Fri Nov 19 20:00:57 2004 UTC (19 years, 6 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.28: +6 -4 lines
Diff to previous 1.28 (colored)

Allow for path names containing spaces and other funny chars (except
tab) by scanning for the tab that separates the date from the
pathname.  If no tab is found, revert back to the old behaviour.
Posix says there should be a space between the pathname and the
date, but all known implementations of diff(1) use a tab.
ok kurt@ deraadt@

Revision 1.28 / (download) - annotate - [select for diffs], Thu Aug 5 21:47:24 2004 UTC (19 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored)

spacing

Revision 1.27 / (download) - annotate - [select for diffs], Fri Oct 31 20:20:45 2003 UTC (20 years, 6 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.26: +30 -19 lines
Diff to previous 1.26 (colored)

o fairly major man page reorganization
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@

Revision 1.26 / (download) - annotate - [select for diffs], Fri Aug 15 08:00:51 2003 UTC (20 years, 9 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.25: +28 -2 lines
Diff to previous 1.25 (colored)

Add license from patch.c to original source files missing a license.

ok deraadt@

Revision 1.25 / (download) - annotate - [select for diffs], Fri Aug 1 20:30:49 2003 UTC (20 years, 9 months ago) by otto
Branch: MAIN
Changes since 1.24: +4 -4 lines
Diff to previous 1.24 (colored)

- use stdbool.h instead of roll-your-own booleans
- 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@

Revision 1.24 / (download) - annotate - [select for diffs], Thu Jul 31 20:51:43 2003 UTC (20 years, 9 months ago) by otto
Branch: MAIN
Changes since 1.23: +5 -4 lines
Diff to previous 1.23 (colored)

Unbreak relative directory handling. Tweak from millert@

ok millert@

Revision 1.23 / (download) - annotate - [select for diffs], Wed Jul 30 15:47:54 2003 UTC (20 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.22: +18 -34 lines
Diff to previous 1.22 (colored)

Make prompting POSIX-compliant.  POSIX states "The patch utility
shall write a prompt to standard output and request a filename
interactively from the controlling terminal (for example, /dev/tty)."
OK deraadt@ and otto@

Revision 1.22 / (download) - annotate - [select for diffs], Tue Jul 29 20:10:17 2003 UTC (20 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.21: +8 -6 lines
Diff to previous 1.21 (colored)

o add pathnames.h
o ignore empty TMPDIR environment variable
o strip any trailing slashes from TMPDIR
otto@ OK

Revision 1.21 / (download) - annotate - [select for diffs], Mon Jul 28 19:05:26 2003 UTC (20 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.20: +7 -7 lines
Diff to previous 1.20 (colored)

Don't treat consecutive slashes as path components; matches POSIX
OK otto@ and deraadt@

Revision 1.20 / (download) - annotate - [select for diffs], Mon Jul 28 18:35:36 2003 UTC (20 years, 9 months ago) by otto
Branch: MAIN
Changes since 1.19: +29 -32 lines
Diff to previous 1.19 (colored)

More cleanup: sprinkled some const, removed ugly EXTERN/INTERN.h,
some rewriting of code to make it more readable and more KNF.

ok millert@ tedu@ deraadt@

Revision 1.19 / (download) - annotate - [select for diffs], Mon Jul 28 16:13:53 2003 UTC (20 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.18: +5 -5 lines
Diff to previous 1.18 (colored)

Make patch(1) exit value match POSIX and be consistent with diff.
Comments and OK from otto@

Revision 1.18 / (download) - annotate - [select for diffs], Fri Jul 25 02:12:45 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.17: +68 -87 lines
Diff to previous 1.17 (colored)

Add POSIX -b option but don't change the default beahvior wrt backups
yet.  The old -b option is now -z (matches GNU patch).

Revision 1.17 / (download) - annotate - [select for diffs], Tue Jul 22 17:52:20 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.16: +3 -3 lines
Diff to previous 1.16 (colored)

just about nothing

Revision 1.16 / (download) - annotate - [select for diffs], Tue Jul 22 17:18:49 2003 UTC (20 years, 10 months ago) by otto
Branch: MAIN
Changes since 1.15: +35 -12 lines
Diff to previous 1.15 (colored)

More cleanup.
ok millert@ tedu@

Revision 1.15 / (download) - annotate - [select for diffs], Mon Jul 21 14:32:21 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

fix header

Revision 1.14 / (download) - annotate - [select for diffs], Mon Jul 21 14:30:31 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.13: +3 -3 lines
Diff to previous 1.13 (colored)

remove a bit more junk

Revision 1.13 / (download) - annotate - [select for diffs], Mon Jul 21 14:00:41 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.12: +308 -314 lines
Diff to previous 1.12 (colored)

knf and other cleanup; ok otto

Revision 1.12 / (download) - annotate - [select for diffs], Fri Jul 18 02:00:09 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.11: +98 -107 lines
Diff to previous 1.11 (colored)

remove junk; ok otto tedu

Revision 1.11 / (download) - annotate - [select for diffs], Tue Apr 8 00:18:31 2003 UTC (21 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.10: +3 -3 lines
Diff to previous 1.10 (colored)

strcpy trashing, help from tedu; ok tedu

Revision 1.10 / (download) - annotate - [select for diffs], Sat Apr 5 17:17:53 2003 UTC (21 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)

string fixes; ok miod henning

Revision 1.9 / (download) - annotate - [select for diffs], Sat Dec 4 21:00:03 1999 UTC (24 years, 5 months ago) by provos
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2, OPENBSD_3_1_BASE, OPENBSD_3_1, OPENBSD_3_0_BASE, OPENBSD_3_0, OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.8: +19 -40 lines
Diff to previous 1.8 (colored)

a few more overflows gone

Revision 1.8 / (download) - annotate - [select for diffs], Sat Dec 4 01:04:14 1999 UTC (24 years, 5 months ago) by provos
Branch: MAIN
Changes since 1.7: +3 -3 lines
Diff to previous 1.7 (colored)

revert strlcpy to strcpy for one case.

Revision 1.7 / (download) - annotate - [select for diffs], Sat Dec 4 01:01:07 1999 UTC (24 years, 5 months ago) by provos
Branch: MAIN
Changes since 1.6: +12 -9 lines
Diff to previous 1.6 (colored)

avoid overflows

Revision 1.6 / (download) - annotate - [select for diffs], Mon Jan 11 00:16:32 1999 UTC (25 years, 4 months ago) by marc
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

fix seg fault on sparc

Revision 1.5 / (download) - annotate - [select for diffs], Sun Jan 3 05:33:48 1999 UTC (25 years, 4 months ago) by millert
Branch: MAIN
Changes since 1.4: +10 -13 lines
Diff to previous 1.4 (colored)

Use libc basename(3) and dirname(3) instead of defining our own.  Also clean up some nasty assumptions that basename() returns a pointer that lies within its argument

Revision 1.4 / (download) - annotate - [select for diffs], Mon Sep 22 05:45:27 1997 UTC (26 years, 8 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.3: +18 -25 lines
Diff to previous 1.3 (colored)

Start of -Wall and cleaning up icky bits.

Revision 1.3 / (download) - annotate - [select for diffs], Tue Sep 24 04:19:30 1996 UTC (27 years, 8 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1, OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.2: +4 -4 lines
Diff to previous 1.2 (colored)

sprintf -> snprintf except where guaranteed safe.

Revision 1.2 / (download) - annotate - [select for diffs], Mon Jun 10 11:21:34 1996 UTC (27 years, 11 months ago) by niklas
Branch: MAIN
Changes since 1.1: +3 -1 lines
Diff to previous 1.1 (colored)

Support the long options that FSF's patch version has.  $OpenBSD$ added

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:45:56 1995 UTC (28 years, 7 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:45:56 1995 UTC (28 years, 7 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.