Re: [patch] TODO for 4.6.1: ./file in tar archive



Leonard den Ottolander wrote:
 	    q = current_file_name;
-	    /* FIXME: should be q = vfs_normalize_dir(q) */
 	    while (q[0] == '.' && q[1] == '/')
 	        q += 2;
 	    if (*q == '.' && *(q+1) == '\0')
-	        q = "";
+	        q++;

Well, that's hard to decide. ;) I just discovered that some lines above the same idiom (str += strlen(str)) is used. The fine points of the semantic are:

>>> q++ <<<
We actually have (and it is important that it is) a pointer to the pathname.

>>> q = "" <<<
q will be assigned an empty string.

Personally, I prefer the second one, as we don't care to which empty string q points.

+	canonicalize_pathname(q);

The function canonicalize_pathname is not suited to the problem. We should split it into two functions:

1. canonicalize_pathname_but_preserve_UNC()
2. canonicalize_unix_pathname

Then we can use canonicalize_unix_pathname to do the job.

As UNC pathnames have nothing to do with Unix I wonder how the function has found its way into util*unix*.c.

Roland



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]