# HG changeset patch # User Matti Hamalainen # Date 1352761586 -7200 # Node ID 02244c553741c95dd5d42042e9763ae4e442d5fa # Parent 9b72d0060b8575978d2265e1a14d906f79f38fac Fix Win32 side of log directory creation. diff -r 9b72d0060b85 -r 02244c553741 main.c --- a/main.c Mon Nov 12 20:08:07 2012 +0200 +++ b/main.c Tue Nov 13 01:06:26 2012 +0200 @@ -1661,8 +1661,8 @@ #ifdef __WIN32 DWORD attr = GetFileAttributes(path); - *isDirectory = (attr & FILE_ATTRIBUTE_DIRECTORY); - *isWritable = (attr & FILE_ATTRIBUTE_READONLY) == 0 && *isDirectory == FALSE; + *isDirectory = (attr & FILE_ATTRIBUTE_DIRECTORY) != 0; + *isWritable = (attr & FILE_ATTRIBUTE_READONLY) == 0; *isReadable = TRUE; #else uid_t id = geteuid(); @@ -1674,6 +1674,9 @@ *isWritable = (id == sb.st_uid && (sb.st_mode & S_IWUSR)); *isReadable = (id == sb.st_uid && (sb.st_mode & S_IRUSR)); #endif + + THERR("'%s': dir=%d, wr=%d, rd=%d\n", + path, *isDirectory, *isWritable, *isReadable); return TRUE; } @@ -1684,6 +1687,7 @@ size_t start = 0, end; BOOL res = FALSE, exists, isDir, isWritable, isReadable; + THMSG(0, "Creating directory %s\n", cpath); do { for (save = 0, end = start; path[end] != 0; end++) @@ -1873,9 +1877,18 @@ else if (!isWritable) { +#ifdef __WIN32 + if (!nn_mkdir_rec(optLogPath)) + { + THERR("Could not create log file directory '%s'.\n", + optLogPath); + goto err_exit; + } +#else THERR("The log file path '%s' is not writable.\n", optLogPath); goto err_exit; +#endif } } else