]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1646. [bug] win32: logging file versions didn't work with
authorMark Andrews <marka@isc.org>
Fri, 4 Jun 2004 02:19:17 +0000 (02:19 +0000)
committerMark Andrews <marka@isc.org>
Fri, 4 Jun 2004 02:19:17 +0000 (02:19 +0000)
                        non-UNC filenames.  [RT#11486]

CHANGES
lib/isc/log.c

diff --git a/CHANGES b/CHANGES
index de3a8bff612a179e8bc0f251fc5135bf7a20103e..a8cb7392539e275fe629175a3d7f114e041e09d8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,7 +4,8 @@
 
 1647.  [placeholder]   rt11445
 
-1646.  [placeholder]   rt11486
+1646.  [bug]           win32: logging file versions didn't work with
+                       non-UNC filenames.  [RT#11486]
 
 1645.  [bug]           named could trigger a REQUIRE failure if multiple
                        masters with keys are specified.
index 21dfffd48a95107ba1370ba3ebbfbeb08dfc6df0..0cbe86a418ce5e77e93e8c0cd837e00df3601be0 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: log.c,v 1.85 2004/04/10 04:33:36 marka Exp $ */
+/* $Id: log.c,v 1.86 2004/06/04 02:19:17 marka Exp $ */
 
 /* Principal Authors: DCL */
 
@@ -1140,6 +1140,10 @@ greatest_version(isc_logchannel_t *channel, int *greatestp) {
        unsigned int basenamelen;
        isc_dir_t dir;
        isc_result_t result;
+       char sep = '/';
+#ifdef _WIN32
+       char *basename2;
+#endif
 
        REQUIRE(channel->type == ISC_LOG_TOFILE);
 
@@ -1147,7 +1151,15 @@ greatest_version(isc_logchannel_t *channel, int *greatestp) {
         * It is safe to DE_CONST the file.name because it was copied
         * with isc_mem_strdup in isc_log_createchannel.
         */
-       basename = strrchr(FILE_NAME(channel), '/');
+       basename = strrchr(FILE_NAME(channel), sep);
+#ifdef _WIN32
+       basename2 = strrchr(FILE_NAME(channel), '\\');
+       if ((basename != NULL && basename2 != NULL && basename2 > basename) ||
+           (basename == NULL && basename2 != NULL)) {
+               basename = basename2;
+               sep = '\\';
+       }
+#endif
        if (basename != NULL) {
                *basename++ = '\0';
                dirname = FILE_NAME(channel);
@@ -1164,7 +1176,7 @@ greatest_version(isc_logchannel_t *channel, int *greatestp) {
         * Replace the file separator if it was taken out.
         */
        if (basename != FILE_NAME(channel))
-               *(basename - 1) = '/';
+               *(basename - 1) = sep;
 
        /*
         * Return if the directory open failed.