cvs commit: src/lib/libarchive archive_read_extract.c

Nate Lawson nate at root.org
Sat Jun 5 07:05:34 GMT 2004


On Fri, 4 Jun 2004, Tim Kientzle wrote:
> kientzle    2004/06/04 22:30:41 PDT
>
>   FreeBSD src repository
>
>   Modified files:
>     lib/libarchive       archive_read_extract.c
>   Log:
>   Recognize when we've accidentally created "foo/."
>   and don't complain about it.
>
>   Revision  Changes    Path
>   1.15      +12 -0     src/lib/libarchive/archive_read_extract.c
>
> --- src/lib/libarchive/archive_read_extract.c:1.14	Thu Jun  3 16:29:47 2004
> +++ src/lib/libarchive/archive_read_extract.c	Fri Jun  4 22:30:41 2004
> @@ -501,6 +501,18 @@
>  		/* Doesn't exist: missing parent dir? */
>  		mkdirpath(a, name);
>  		if (mkdir(name, mode) == 0)
> +			return (ARCHIVE_OK);
> +		/*
> +		 * Yes, people really do type "tar -cf - foo/." for
> +		 * reasons that I cannot fathom.  When they do, the
> +		 * dir "foo" gets created in mkdirpath() and the
> +		 * mkdir("foo/.") just above still fails.  So, I've
> +		 * added yet another check here to catch this
> +		 * particular case.

That's what tab completion in tcsh does.

> +		 *
> +		 * There must be a better way ...
> +		 */
> +		if (stat(name, &st) == 0  &&  S_ISDIR(st.st_mode))
                                        ^^^^^^^
Double spaces.

-Nate


More information about the cvs-all mailing list