wimlib_iterate_dir_tree(): Canonicalize WIM path
authorEric Biggers <ebiggers3@gmail.com>
Wed, 8 Jan 2014 02:32:39 +0000 (20:32 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Wed, 8 Jan 2014 02:32:39 +0000 (20:32 -0600)
NEWS
src/dentry.c

diff --git a/NEWS b/NEWS
index 0f28b5c..8dae65d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,8 +6,8 @@ Version 1.6.1:
        Stored files with size exactly 4 GiB (4,294,967,296 bytes) are now
        decompressed correctly.
 
-       Paths passed to wimlib_extract_paths() may now use either forwards or
-       backwards slashes, as documented.
+       Paths passed to wimlib_extract_paths() and wimlib_iterate_dir_tree() may
+       now use either forwards or backwards slashes, as documented.
 
        Fixed a potential stack overflow when extracting solid archives (packed
        streams) containing more than about 100000 files.
index e87bfef..b18375f 100644 (file)
@@ -2705,10 +2705,16 @@ image_do_iterate_dir_tree(WIMStruct *wim)
 
 /* API function documented in wimlib.h  */
 WIMLIBAPI int
-wimlib_iterate_dir_tree(WIMStruct *wim, int image, const tchar *path,
+wimlib_iterate_dir_tree(WIMStruct *wim, int image, const tchar *_path,
                        int flags,
                        wimlib_iterate_dir_tree_callback_t cb, void *user_ctx)
 {
+       tchar *path;
+       int ret;
+
+       path = canonicalize_wim_path(_path);
+       if (path == NULL)
+               return WIMLIB_ERR_NOMEM;
        struct image_iterate_dir_tree_ctx ctx = {
                .path = path,
                .flags = flags,
@@ -2716,7 +2722,9 @@ wimlib_iterate_dir_tree(WIMStruct *wim, int image, const tchar *path,
                .user_ctx = user_ctx,
        };
        wim->private = &ctx;
-       return for_image(wim, image, image_do_iterate_dir_tree);
+       ret = for_image(wim, image, image_do_iterate_dir_tree);
+       FREE(path);
+       return ret;
 }
 
 /* Returns %true iff the metadata of @inode and @template_inode are reasonably