view sources/patches/busybox-fixpatch.patch @ 1428:f5ba63db222d

Fix the busybox patch I sent upstream to work with hunks at the start of file.
author Rob Landley <rob@landley.net>
date Sat, 20 Aug 2011 12:26:25 -0500
parents 14739f3ae2a5
children
line wrap: on
line source

I broke patch's ability to create files in November, and nobody noticed in
the ensuing 11 months.  Sigh.

diff --git a/editors/patch.c b/editors/patch.c
index 9c6d967..dd142ec 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -67,8 +67,7 @@ struct double_list {
 
 // Free all the elements of a linked list
 // Call freeit() on each element before freeing it.
-static
-void dlist_free(struct double_list *list, void (*freeit)(void *data))
+static void dlist_free(struct double_list *list, void (*freeit)(void *data))
 {
 	while (list) {
 		void *pop = list;
@@ -80,8 +79,7 @@ void dlist_free(struct double_list *list, void (*freeit)(void *data))
 }
 
 // Add an entry before "list" element in (circular) doubly linked list
-static
-struct double_list *dlist_add(struct double_list **list, char *data)
+static struct double_list *dlist_add(struct double_list **list, char *data)
 {
 	struct double_list *llist;
 	struct double_list *line = xmalloc(sizeof(*line));
@@ -229,7 +227,7 @@ static int apply_one_hunk(void)
 		else matcheof = 0;
 		if (PATCH_DEBUG) fdprintf(2, "HUNK:%s\n", plist->data);
 	}
-	matcheof = matcheof < TT.context;
+	matcheof = !matcheof || matcheof < TT.context;
 
 	if (PATCH_DEBUG) fdprintf(2,"MATCHEOF=%c\n", matcheof ? 'Y' : 'N');