aboutsummaryrefslogtreecommitdiff
path: root/toys/patch.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/patch.c')
-rw-r--r--toys/patch.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/toys/patch.c b/toys/patch.c
index b44bca24..84e4d197 100644
--- a/toys/patch.c
+++ b/toys/patch.c
@@ -219,6 +219,13 @@ void patch_main(void)
patchline = get_line(TT.filepatch);
if (!patchline) break;
+ // Other versions of patch accept damaged patches,
+ // so we need to also.
+ if (!*patchline) {
+ free(patchline);
+ patchline = xstrdup(" ");
+ }
+
// Are we assembling a hunk?
if (state >= 2) {
if (*patchline==' ' || *patchline=='+' || *patchline=='-') {