diff options
author | Denis Vlasenko | 2007-08-06 13:34:10 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-08-06 13:34:10 +0000 |
commit | eea72123a36df9e93b55989ee9c77ba764e88485 (patch) | |
tree | 1d489f5e4c5eb5330d4634e6cf9b3ae9c70e9a8c /editors | |
parent | 8e209c3787f3b7d7bda3915afc6df0604b60707c (diff) | |
download | busybox-eea72123a36df9e93b55989ee9c77ba764e88485.zip busybox-eea72123a36df9e93b55989ee9c77ba764e88485.tar.gz |
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.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/editors/patch.c b/editors/patch.c index 5f7f7d0..f071a08 100644 --- a/editors/patch.c +++ b/editors/patch.c @@ -55,10 +55,12 @@ static char *extract_filename(char *line, int patch_level) int i; /* Terminate string at end of source filename */ - temp = strchr(filename_start_ptr, '\t'); - if (temp) *temp = 0; + temp = strchrnul(filename_start_ptr, '\t'); + *temp = '\0'; - /* skip over (patch_level) number of leading directories */ + /* Skip over (patch_level) number of leading directories */ + if (patch_level == -1) + patch_level = INT_MAX; for (i = 0; i < patch_level; i++) { temp = strchr(filename_start_ptr, '/'); if (!temp) |