split.c: fix finding extension of first split WIM part master
authorEric Biggers <ebiggers3@gmail.com>
Wed, 28 Feb 2018 03:31:58 +0000 (19:31 -0800)
committerEric Biggers <ebiggers3@gmail.com>
Wed, 28 Feb 2018 03:51:47 +0000 (19:51 -0800)
Silly old bug: wimlib_split() considered the first dot in the SWM path
to begin the filename extension.  But of course, there can be other dots
in the path; we need to look for the last dot in the last component.

NEWS
src/split.c

diff --git a/NEWS b/NEWS
index a2e812f..5213d67 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,9 @@ Version 1.13.0-BETA:
        existing integrity tables.  This can be useful to avoid unwanted
        verification of large WIM files, e.g. WIMs given by '--delta-from'.
 
+       wimsplit (API: wimlib_split()) now correctly handles a dot in the path
+       to the first split WIM part, prior to the filename extension.
+
        'wimlib-imagex --version' now shows the version of the library it is
        actually using (in case it is different from wimlib-imagex's version).
 
index 795fb2c..1313a59 100644 (file)
@@ -31,6 +31,7 @@
 #include "wimlib/error.h"
 #include "wimlib/list.h"
 #include "wimlib/metadata.h"
+#include "wimlib/paths.h"
 #include "wimlib/progress.h"
 #include "wimlib/resource.h"
 #include "wimlib/wim.h"
@@ -74,7 +75,7 @@ write_split_wim(WIMStruct *orig_wim, const tchar *swm_name,
        swm_name_len = tstrlen(swm_name);
        swm_name_buf = alloca((swm_name_len + 20) * sizeof(tchar));
        tstrcpy(swm_name_buf, swm_name);
-       dot = tstrchr(swm_name_buf, T('.'));
+       dot = tstrrchr(path_basename(swm_name_buf), T('.'));
        if (dot) {
                swm_base_name_len = dot - swm_name_buf;
                swm_suffix = alloca((tstrlen(dot) + 1) * sizeof(tchar));