diff options
author | Rob Landley <rob@landley.net> | 2006-05-07 21:10:06 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-05-07 21:10:06 +0000 |
commit | baa89b398d700b183b4c71b214b843c7d1e9bce3 (patch) | |
tree | 483dee1eb5ee32e13196d0d12ca828c4f8017d8c | |
parent | a336e7cc25703fef6a95238325e3521b32654b0a (diff) |
Patch to fix bug 868, and some related cleanup while I was in the area.
A tab is now taken as the end of filename if it's there, but if it isn't
(because the timestamp isn't there) we continue with the existing untruncated
line as the filename.
-rw-r--r-- | editors/patch.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/editors/patch.c b/editors/patch.c index 9a3740882..337d1bbad 100644 --- a/editors/patch.c +++ b/editors/patch.c @@ -54,29 +54,17 @@ static unsigned int copy_lines(FILE *src_stream, FILE *dest_stream, const unsign static char *extract_filename(char *line, int patch_level) { - char *filename_start_ptr = line + 4; + char *temp, *filename_start_ptr = line + 4; int i; /* Terminate string at end of source filename */ - { - char *line_ptr; - line_ptr = strchr(filename_start_ptr, '\t'); - if (!line_ptr) { - bb_perror_msg("Malformed line %s", line); - return(NULL); - } - *line_ptr = '\0'; - } + temp = strchr(filename_start_ptr, '\t'); + if (temp) *temp = 0; - /* Skip over (patch_level) number of leading directories */ + /* skip over (patch_level) number of leading directories */ for (i = 0; i < patch_level; i++) { - char *dirname_ptr; - - dirname_ptr = strchr(filename_start_ptr, '/'); - if (!dirname_ptr) { - break; - } - filename_start_ptr = dirname_ptr + 1; + if(!(temp = strchr(filename_start_ptr, '/'))) break; + filename_start_ptr = temp + 1; } return(bb_xstrdup(filename_start_ptr)); |