svn commit: trunk/busybox/editors

landley at busybox.net landley at busybox.net
Sun May 7 21:10:08 UTC 2006


Author: landley
Date: 2006-05-07 14:10:06 -0700 (Sun, 07 May 2006)
New Revision: 15025

Log:
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.


Modified:
   trunk/busybox/editors/patch.c


Changeset:
Modified: trunk/busybox/editors/patch.c
===================================================================
--- trunk/busybox/editors/patch.c	2006-05-07 20:58:55 UTC (rev 15024)
+++ trunk/busybox/editors/patch.c	2006-05-07 21:10:06 UTC (rev 15025)
@@ -54,29 +54,17 @@
 
 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));




More information about the busybox-cvs mailing list