Wine 1.6 gives a standard output handle to the service process,
albeit all writes to it fails. Because of this, TLogger.AddStdLine
did not even write to the log file due to short-circuit evaluation.
Now I made sure to attempt both stdout and logfile writes.
Native Windows doesn't provide an stdout handle for service processes
(GetStdHandle returns 0), in which case MgSMTP detects it has no
stdout and redirects its output to mgsmtp_stdout.log. Wine 3.0 behaves
the same, so I deemed the Wine 1.6 behaviour a bug. Therefore, I find
this quick fix sufficient - there is no need to bother with Wine 1.6
compatibility any further, e.g. by checking if Wine 1.6 gave a writable
stdout handle or not. Users of MgSMTP on Wine are rather suggested to
update to Wine 3.0.
modified: Log.pas
modified: MgSMTP.pas
{
MegaBrutal's SMTP Server (MgSMTP)
{
MegaBrutal's SMTP Server (MgSMTP)
- Copyright (C) 2010-2014 MegaBrutal
+ Copyright (C) 2010-2018 MegaBrutal
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
function TLogger.AddStdLine(Line: string): boolean;
{ Log message to both stdout and smtp.log. }
function TLogger.AddStdLine(Line: string): boolean;
{ Log message to both stdout and smtp.log. }
+var outresult, logresult: boolean;
- Result:= Out.AddLine(Line) and AddLine(Line);
+ outresult:= Out.AddLine(Line);
+ logresult:= AddLine(Line);
+ Result:= outresult and logresult;
end;
function TLogger.AddStdLine(Agent, Line: string): boolean;
{ Log message to both stdout and smtp.log. }
end;
function TLogger.AddStdLine(Agent, Line: string): boolean;
{ Log message to both stdout and smtp.log. }
+var outresult, logresult: boolean;
- Result:= Out.AddLine(Agent, Line) and AddLine(Agent, Line);
+ outresult:= Out.AddLine(Agent, Line);
+ logresult:= AddLine(Agent, Line);
+ Result:= outresult and logresult;
document what bugfix/feature are you testing with the actual build.
This will be logged to help you differentiate outputs of subsequent
builds in your logs. If left empty, it won't be added to the logs. }
document what bugfix/feature are you testing with the actual build.
This will be logged to help you differentiate outputs of subsequent
builds in your logs. If left empty, it won't be added to the logs. }
- DEVCOMMENT = 'ListenAddress';
+ DEVCOMMENT = 'Wine 1.6 AddStdLine fix';