make the code, which was supposed to iterate file log number (if no access) and fallback to stderr in worst case rather than segfault, actually work
--- a/hedgewars/uUtils.pas Sat Nov 29 15:25:09 2014 +0100
+++ b/hedgewars/uUtils.pas Sat Nov 29 15:38:28 2014 +0100
@@ -538,9 +538,6 @@
InitCriticalSection(logMutex);
{$ENDIF}
{$I-}
-{$IFNDEF PAS2C}
- logFile:= stderr; // if everything fails, write to stderr
-{$ENDIF}
if (length(UserPathPrefix) > 0) then
begin
{$IFNDEF PAS2C}
@@ -553,12 +550,20 @@
while(i < 7) do
begin
assign(logFile, shortstring(UserPathPrefix) + '/Logs/' + logfileBase + inttostr(i) + '.log');
+ Rewrite(logFile);
if IOResult = 0 then
break;
inc(i)
end;
end;
- Rewrite(logFile);
+
+{$IFNDEF PAS2C}
+ if (length(UserPathPrefix) = 0) or (IOResult = 0) then
+ begin
+ logFile:= stderr; // if everything fails, write to stderr
+ Rewrite(logFile);
+ end;
+{$ENDIF}
{$I+}
{$ENDIF}