aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-06 13:34:10 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-06 13:34:10 +0000
commiteea72123a36df9e93b55989ee9c77ba764e88485 (patch)
tree1d489f5e4c5eb5330d4634e6cf9b3ae9c70e9a8c /editors
parent8e209c3787f3b7d7bda3915afc6df0604b60707c (diff)
downloadbusybox-w32-eea72123a36df9e93b55989ee9c77ba764e88485.tar.gz
busybox-w32-eea72123a36df9e93b55989ee9c77ba764e88485.tar.bz2
busybox-w32-eea72123a36df9e93b55989ee9c77ba764e88485.zip
patch: fix -p -1 handling
checkstack.pl: add blackfin (by Alex Landau <landau_alex@yahoo.com>)
Diffstat (limited to 'editors')
-rw-r--r--editors/patch.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/editors/patch.c b/editors/patch.c
index 5f7f7d028..f071a0854 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -55,10 +55,12 @@ static char *extract_filename(char *line, int patch_level)
55 int i; 55 int i;
56 56
57 /* Terminate string at end of source filename */ 57 /* Terminate string at end of source filename */
58 temp = strchr(filename_start_ptr, '\t'); 58 temp = strchrnul(filename_start_ptr, '\t');
59 if (temp) *temp = 0; 59 *temp = '\0';
60 60
61 /* skip over (patch_level) number of leading directories */ 61 /* Skip over (patch_level) number of leading directories */
62 if (patch_level == -1)
63 patch_level = INT_MAX;
62 for (i = 0; i < patch_level; i++) { 64 for (i = 0; i < patch_level; i++) {
63 temp = strchr(filename_start_ptr, '/'); 65 temp = strchr(filename_start_ptr, '/');
64 if (!temp) 66 if (!temp)