CVS commit: src/usr.bin/patch

2023-06-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Jun 16 23:36:26 UTC 2023

Modified Files:
src/usr.bin/patch: inp.c

Log Message:
Fix memory leak

CVS: --
CVS: CVSROOT  cvs.NetBSD.org:/cvsroot
CVS: please use "PR category/123" to have the commitmsg appended to PR 123
CVS:
CVS: Please evaluate your changes and consider the following.
CVS: Abort checkin if you answer no.
CVS: => For all changes:
CVS: Do the changed files compile?
CVS: Has the change been tested?
CVS: => If you are not completely familiar with the changed components:
CVS: Has the change been posted for review?
CVS: Have you allowed enough time for feedback?
CVS: => If the change is major:
CVS: => If the change adds files to, or removes files from $DESTDIR:
CVS: => If you are changing a library or kernel interface:
CVS: Have you successfully run "./build.sh release"?


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/patch/inp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/patch/inp.c
diff -u src/usr.bin/patch/inp.c:1.29 src/usr.bin/patch/inp.c:1.30
--- src/usr.bin/patch/inp.c:1.29	Fri Jun 16 23:32:37 2023
+++ src/usr.bin/patch/inp.c	Fri Jun 16 23:36:26 2023
@@ -1,7 +1,7 @@
 /*
  * $OpenBSD: inp.c,v 1.34 2006/03/11 19:41:30 otto Exp $
  * $DragonFly: src/usr.bin/patch/inp.c,v 1.6 2007/09/29 23:11:10 swildner Exp $
- * $NetBSD: inp.c,v 1.29 2023/06/16 23:32:37 wiz Exp $
+ * $NetBSD: inp.c,v 1.30 2023/06/16 23:36:26 wiz Exp $
  */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: inp.c,v 1.29 2023/06/16 23:32:37 wiz Exp $");
+__RCSID("$NetBSD: inp.c,v 1.30 2023/06/16 23:36:26 wiz Exp $");
 
 #include 
 #include 
@@ -271,6 +271,7 @@ plan_a(const char *filename)
 		} else if (statfailed) {
 			fatal("can't find %s\n", filename);
 		}
+		free(lbuf);
 		free(tmp_filename1);
 		free(tmp_filename2);
 	}



CVS commit: src/usr.bin/patch

2023-06-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Jun 16 23:36:26 UTC 2023

Modified Files:
src/usr.bin/patch: inp.c

Log Message:
Fix memory leak

CVS: --
CVS: CVSROOT  cvs.NetBSD.org:/cvsroot
CVS: please use "PR category/123" to have the commitmsg appended to PR 123
CVS:
CVS: Please evaluate your changes and consider the following.
CVS: Abort checkin if you answer no.
CVS: => For all changes:
CVS: Do the changed files compile?
CVS: Has the change been tested?
CVS: => If you are not completely familiar with the changed components:
CVS: Has the change been posted for review?
CVS: Have you allowed enough time for feedback?
CVS: => If the change is major:
CVS: => If the change adds files to, or removes files from $DESTDIR:
CVS: => If you are changing a library or kernel interface:
CVS: Have you successfully run "./build.sh release"?


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/patch/inp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/patch

2023-06-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Jun 16 23:32:37 UTC 2023

Modified Files:
src/usr.bin/patch: inp.c

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/patch/inp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/patch/inp.c
diff -u src/usr.bin/patch/inp.c:1.28 src/usr.bin/patch/inp.c:1.29
--- src/usr.bin/patch/inp.c:1.28	Wed May 26 07:57:05 2021
+++ src/usr.bin/patch/inp.c	Fri Jun 16 23:32:37 2023
@@ -1,19 +1,19 @@
 /*
  * $OpenBSD: inp.c,v 1.34 2006/03/11 19:41:30 otto Exp $
  * $DragonFly: src/usr.bin/patch/inp.c,v 1.6 2007/09/29 23:11:10 swildner Exp $
- * $NetBSD: inp.c,v 1.28 2021/05/26 07:57:05 cjep Exp $
+ * $NetBSD: inp.c,v 1.29 2023/06/16 23:32:37 wiz Exp $
  */
 
 /*
  * patch - a program to apply diffs to original files
- * 
+ *
  * Copyright 1986, Larry Wall
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following condition is met:
  * 1. Redistributions of source code must retain the above copyright notice,
  * this condition and the following disclaimer.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -25,13 +25,13 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * -C option added in 1998, original code by Marc Espie, based on FreeBSD
  * behaviour
  */
 
 #include 
-__RCSID("$NetBSD: inp.c,v 1.28 2021/05/26 07:57:05 cjep Exp $");
+__RCSID("$NetBSD: inp.c,v 1.29 2023/06/16 23:32:37 wiz Exp $");
 
 #include 
 #include 
@@ -142,7 +142,7 @@ static bool
 plan_a(const char *filename)
 {
 	int		ifd, statfailed, devnull, pstat;
-	char		*p, *s, *lbuf; 
+	char		*p, *s, *lbuf;
 	struct stat	filestat;
 	off_t		i;
 	ptrdiff_t	sz;
@@ -190,7 +190,7 @@ plan_a(const char *filename)
 		tmp_filename2 = strdup(filename);
 		if (tmp_filename1 == NULL || tmp_filename2 == NULL)
 			fatal("strdupping filename");
- 
+
  		filebase = basename(tmp_filename1);
  		filedir = dirname(tmp_filename2);
 
@@ -198,7 +198,7 @@ plan_a(const char *filename)
 		if ((lbuf = malloc(bufsz)) == NULL)
 			pfatal("allocating line buffer");
 		lbuf[0] = '\0';
- 
+
 #define try(f, a1, a2, a3) \
 	(snprintf(lbuf, lbufsz, f, a1, a2, a3), stat(lbuf, ) == 0)
 



CVS commit: src/usr.bin/patch

2023-06-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Jun 16 23:32:37 UTC 2023

Modified Files:
src/usr.bin/patch: inp.c

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/patch/inp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/patch

2023-06-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Jun 16 23:31:54 UTC 2023

Modified Files:
src/usr.bin/patch: pch.c

Log Message:
Comment out variable assignations that are not used.

Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/patch/pch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/patch/pch.c
diff -u src/usr.bin/patch/pch.c:1.32 src/usr.bin/patch/pch.c:1.33
--- src/usr.bin/patch/pch.c:1.32	Tue May 25 11:25:59 2021
+++ src/usr.bin/patch/pch.c	Fri Jun 16 23:31:53 2023
@@ -1,19 +1,19 @@
 /*
  * $OpenBSD: pch.c,v 1.37 2007/09/02 15:19:33 deraadt Exp $
  * $DragonFly: src/usr.bin/patch/pch.c,v 1.6 2008/08/10 23:35:40 joerg Exp $
- * $NetBSD: pch.c,v 1.32 2021/05/25 11:25:59 cjep Exp $
+ * $NetBSD: pch.c,v 1.33 2023/06/16 23:31:53 wiz Exp $
  */
 
 /*
  * patch - a program to apply diffs to original files
- * 
+ *
  * Copyright 1986, Larry Wall
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following condition is met:
  * 1. Redistributions of source code must retain the above copyright notice,
  * this condition and the following disclaimer.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -25,13 +25,13 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * -C option added in 1998, original code by Marc Espie, based on FreeBSD
  * behaviour
  */
 
 #include 
-__RCSID("$NetBSD: pch.c,v 1.32 2021/05/25 11:25:59 cjep Exp $");
+__RCSID("$NetBSD: pch.c,v 1.33 2023/06/16 23:31:53 wiz Exp $");
 
 #include 
 #include 
@@ -553,7 +553,7 @@ another_hunk(void)
 		p_context = 100;
 		p_hunk_beg = p_input_line + 1;
 		while (p_end < p_max) {
-			line_beginning = ftell(pfp);
+			// line_beginning = ftell(pfp);
 			ret = pgetline(, , pfp);
 			p_input_line++;
 			if (ret == -1) {
@@ -935,7 +935,7 @@ hunk_done:
 		context = 0;
 		p_hunk_beg = p_input_line + 1;
 		while (fillold <= p_ptrn_lines || fillnew <= p_end) {
-			line_beginning = ftell(pfp);
+			// line_beginning = ftell(pfp);
 			ret = pgetline(, , pfp);
 			p_input_line++;
 			if (ret == -1) {



CVS commit: src/usr.bin/patch

2023-06-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Jun 16 23:31:54 UTC 2023

Modified Files:
src/usr.bin/patch: pch.c

Log Message:
Comment out variable assignations that are not used.

Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/patch/pch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/patch

2023-06-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Jun 16 11:27:00 UTC 2023

Modified Files:
src/usr.bin/patch: patch.1 patch.c

Log Message:
patch: add --backup-if-mismatch and --no-backup-if-mismatch for GNU patch 
compatibility

These options only make sense in POSIX mode, since NetBSD's patch
has --backup enabled by default and GNU patch doesn't.

In POSIX mode, GNU patch and NetBSD patch now behave the same for these
two options.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/patch/patch.1
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/patch/patch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/patch/patch.1
diff -u src/usr.bin/patch/patch.1:1.21 src/usr.bin/patch/patch.1:1.22
--- src/usr.bin/patch/patch.1:1.21	Mon Jul  3 21:34:20 2017
+++ src/usr.bin/patch/patch.1	Fri Jun 16 11:27:00 2023
@@ -1,6 +1,6 @@
 .\"	$OpenBSD: patch.1,v 1.22 2008/06/06 20:44:00 jmc Exp $
 .\"	$DragonFly: src/usr.bin/patch/patch.1,v 1.10 2008/08/18 19:15:55 joerg Exp $
-.\"	$NetBSD: patch.1,v 1.21 2017/07/03 21:34:20 wiz Exp $
+.\"	$NetBSD: patch.1,v 1.22 2023/06/16 11:27:00 wiz Exp $
 .\" Copyright 1986, Larry Wall
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -21,7 +21,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd November 7, 2015
+.Dd June 16, 2023
 .Dt PATCH 1
 .Os
 .Sh NAME
@@ -41,6 +41,8 @@
 .Op Fl V Cm t | nil | never | none
 .Op Fl x Ar number
 .Op Fl z Ar backup-ext
+.Op Fl Fl backup-if-mismatch
+.Op Fl Fl no-backup-if-mismatch
 .Op Fl Fl posix
 .Op Ar origfile Op Ar patchfile
 .Nm
@@ -100,8 +102,15 @@ backup is made.
 This is equivalent to specifying
 .Qo Fl V Cm existing Qc .
 This option is currently the default, unless
-.Fl -posix
+.Fl Fl posix
 is specified.
+.It Fl Fl backup-if-mismatch
+Create a backup file if the patch doesn't apply cleanly.
+This option only makes sense when
+.Fl Fl backup
+is disabled, i.e. when in
+.Fl Fl posix
+mode.
 .It Fl C , Fl Fl check
 Checks that the patch would apply cleanly, but does not modify anything.
 .It Fl c , Fl Fl context
@@ -177,6 +186,10 @@ See also
 Forces
 .Nm
 to interpret the patch file as a normal diff.
+.It Fl Fl no-backup-if-mismatch
+Turn off
+.Fl Fl backup-if-mismatch .
+This option exists mostly for compatibility with GNU patch.
 .It Fl o Ar out-file , Fl Fl output Ar out-file
 Causes the next argument to be interpreted as the output file name.
 .It Fl p Ar strip-count , Fl Fl strip Ar strip-count
@@ -604,7 +617,7 @@ utility is compliant with the
 .St -p1003.1-2004
 specification
 (except as detailed above for the
-.Fl -posix
+.Fl Fl posix
 option),
 though the presence of
 .Nm
@@ -613,7 +626,7 @@ itself is optional.
 The flags
 .Op Fl CEfstuvBFVxz
 and
-.Op Fl -posix
+.Op Fl Fl posix
 are extensions to that specification.
 .Sh AUTHORS
 .An Larry Wall

Index: src/usr.bin/patch/patch.c
diff -u src/usr.bin/patch/patch.c:1.33 src/usr.bin/patch/patch.c:1.34
--- src/usr.bin/patch/patch.c:1.33	Mon Sep 20 23:22:36 2021
+++ src/usr.bin/patch/patch.c	Fri Jun 16 11:27:00 2023
@@ -1,7 +1,7 @@
 /*
  * $OpenBSD: patch.c,v 1.45 2007/04/18 21:52:24 sobrado Exp $
  * $DragonFly: src/usr.bin/patch/patch.c,v 1.10 2008/08/10 23:39:56 joerg Exp $
- * $NetBSD: patch.c,v 1.33 2021/09/20 23:22:36 dholland Exp $
+ * $NetBSD: patch.c,v 1.34 2023/06/16 11:27:00 wiz Exp $
  */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: patch.c,v 1.33 2021/09/20 23:22:36 dholland Exp $");
+__RCSID("$NetBSD: patch.c,v 1.34 2023/06/16 11:27:00 wiz Exp $");
 
 #include 
 #include 
@@ -91,6 +91,7 @@ int		diff_type = 0;
 char		*revision = NULL;	/* prerequisite revision, if any */
 LINENUM		input_lines = 0;	/* how long is input file in lines */
 int		posix = 0;		/* strict POSIX mode? */
+int		backup_if_mismatch = -1;/* create backup file when patch doesn't apply cleanly */
 
 static void	reinitialize_almost_everything(void);
 static void	get_some_switches(void);
@@ -374,12 +375,17 @@ main(int argc, char *argv[])
 			char	*realout = outname;
 
 			if (!check_only) {
+/* handle --backup-if-mismatch */
+enum backup_type saved = backup_type;
+if (failed > 0 && backup_if_mismatch > 0 && backup_type == none)
+	backup_type = simple;
 if (move_file(TMPOUTNAME, outname) < 0) {
 	toutkeep = true;
 	realout = TMPOUTNAME;
 	chmod(TMPOUTNAME, filemode);
 } else
 	chmod(outname, filemode);
+backup_type = saved;
 
 if (remove_empty_files &&
 stat(realout, ) == 0 &&
@@ -410,7 +416,7 @@ main(int argc, char *argv[])
 say("%d out of %d hunks ignored--saving rejects to %s\n",
 failed, hunk, rejname);
 			} else {
-say("%d out of %d hunks failed--saving rejects to %s\n",
+say("%d out of %d hunks FAILED -- saving rejects to %s\n",
 failed, hunk, rejname);
 			}
 			if (!check_only && 

CVS commit: src/usr.bin/patch

2023-06-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Jun 16 11:27:00 UTC 2023

Modified Files:
src/usr.bin/patch: patch.1 patch.c

Log Message:
patch: add --backup-if-mismatch and --no-backup-if-mismatch for GNU patch 
compatibility

These options only make sense in POSIX mode, since NetBSD's patch
has --backup enabled by default and GNU patch doesn't.

In POSIX mode, GNU patch and NetBSD patch now behave the same for these
two options.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/patch/patch.1
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/patch/patch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/patch

2021-09-20 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Sep 20 23:22:36 UTC 2021

Modified Files:
src/usr.bin/patch: patch.c

Log Message:
Fix the message that appears if you patch -R an unapplied patch.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/patch/patch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/patch/patch.c
diff -u src/usr.bin/patch/patch.c:1.32 src/usr.bin/patch/patch.c:1.33
--- src/usr.bin/patch/patch.c:1.32	Tue May 25 11:25:59 2021
+++ src/usr.bin/patch/patch.c	Mon Sep 20 23:22:36 2021
@@ -1,7 +1,7 @@
 /*
  * $OpenBSD: patch.c,v 1.45 2007/04/18 21:52:24 sobrado Exp $
  * $DragonFly: src/usr.bin/patch/patch.c,v 1.10 2008/08/10 23:39:56 joerg Exp $
- * $NetBSD: patch.c,v 1.32 2021/05/25 11:25:59 cjep Exp $
+ * $NetBSD: patch.c,v 1.33 2021/09/20 23:22:36 dholland Exp $
  */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: patch.c,v 1.32 2021/05/25 11:25:59 cjep Exp $");
+__RCSID("$NetBSD: patch.c,v 1.33 2021/09/20 23:22:36 dholland Exp $");
 
 #include 
 #include 
@@ -284,12 +284,14 @@ main(int argc, char *argv[])
 			skip_rest_of_patch = true;
 		} else if (batch) {
 			if (verbose)
-say("%seversed (or previously applied) patch detected!  %s -R.",
+say("%seversed (or %spreviously applied) patch detected!  %s -R.",
 reverse ? "R" : "Unr",
+reverse ? "" : "not ",
 reverse ? "Assuming" : "Ignoring");
 		} else {
-			ask("%seversed (or previously applied) patch detected!  %s -R? [y] ",
+			ask("%seversed (or %spreviously applied) patch detected!  %s -R? [y] ",
 			reverse ? "R" : "Unr",
+			reverse ? "" : "not ",
 			reverse ? "Assume" : "Ignore");
 			if (*buf == 'n') {
 ask("Apply anyway? [n] ");



CVS commit: src/usr.bin/patch

2021-09-20 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Sep 20 23:22:36 UTC 2021

Modified Files:
src/usr.bin/patch: patch.c

Log Message:
Fix the message that appears if you patch -R an unapplied patch.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/patch/patch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.bin/patch

2015-08-11 Thread David Laight
On Thu, Jul 30, 2015 at 05:47:51PM -0400, Christos Zoulas wrote:
 Module Name:  src
 Committed By: christos
 Date: Thu Jul 30 21:47:51 UTC 2015
 
 Modified Files:
   src/usr.bin/patch: pch.c
 
 Log Message:
 from bitrieg:
 
 Substitution commands might contain a newline in the replacement pattern
 (escaped with a backslash before it), causing patch's understanding of
 the state the ed child process is in to diverge from reality. This can
 lead to patch unwillingly feeding '!' (execute shell command) lines to
 ed. Finding out how to do this is left as an exercise to the reader.
 
 XXX: pullup-7

Maybe patch should stop ed from executing shell commands.
Setting SHELL=/bin/false might be enough.

David

-- 
David Laight: da...@l8s.co.uk


Re: CVS commit: src/usr.bin/patch

2015-08-09 Thread Joerg Sonnenberger
On Fri, Jul 24, 2015 at 02:56:44PM -0400, Christos Zoulas wrote:
 Module Name:  src
 Committed By: christos
 Date: Fri Jul 24 18:56:44 UTC 2015
 
 Modified Files:
   src/usr.bin/patch: common.h
 
 Log Message:
 Use absolute paths for RCS commands (Martin Natano)

I'm against this. It doesn't make sense if we ever drop RCS and it
doesn't make sense for the portable version either.

Joerg


CVS commit: src/usr.bin/patch

2010-01-09 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Jan 10 01:10:16 UTC 2010

Modified Files:
src/usr.bin/patch: util.c

Log Message:
Plug a memory leak. From Igor Zinovik.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/patch/util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.bin/patch

2009-04-15 Thread Tobias Nygren
On Mon, 13 Apr 2009 00:07:26 +
Luke Mewburn lu...@netbsd.org wrote:

 Modified Files:
   src/usr.bin/patch: inp.c
 
 Log Message:
 Fix sign-compare issue
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.19 -r1.20 src/usr.bin/patch/inp.c

What about platforms where off_t is too small to hold SIZE_MAX?
At least on amd64 the condition now always evaluates to true.

Kind regards,
-Tobias