From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag9Ve-0000jp-D1 for qemu-devel@nongnu.org; Wed, 16 Mar 2016 07:21:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ag9Vb-00055M-7u for qemu-devel@nongnu.org; Wed, 16 Mar 2016 07:21:02 -0400 Received: from mail-db5eur01on0093.outbound.protection.outlook.com ([104.47.2.93]:36832 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag9Va-00053A-FE for qemu-devel@nongnu.org; Wed, 16 Mar 2016 07:20:59 -0400 References: <1457954501-26528-1-git-send-email-den@openvz.org> <1457954501-26528-4-git-send-email-den@openvz.org> <56E6CAA9.9020908@redhat.com> From: "Denis V. Lunev" Message-ID: <56E9418E.7080105@openvz.org> Date: Wed, 16 Mar 2016 14:20:46 +0300 MIME-Version: 1.0 In-Reply-To: <56E6CAA9.9020908@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/9] log: improve code in do_qemu_set_log List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, Stefan Hajnoczi On 03/14/2016 05:28 PM, Paolo Bonzini wrote: > > On 14/03/2016 12:21, Denis V. Lunev wrote: >> /* In case -D is given do not redirect stderr to /dev/null */ >> - if (!qemu_logfile) { >> + if (!qemu_logfile || qemu_logfile == stderr) { >> dup2(fd, 2); > This relies on knowledge that fileno(qemu_logfile) is dup-ed to stderr. actually the comment 2 lines above is exactly about this :)))))) > I'm not sure what's the problem in commit c586eac33; the idea is that, > if -daemonize is given, a named logfile should always be open (so that > stderr is redirected) but stderr should not be used as log destination > (because that's just /dev/null). That's clear from the condition: > > is_daemonized() ? logfilename != NULL : qemu_loglevel > > Paolo The question here is the following actually. Should we continue to keep writing 'stderr' output to the log file when we have cleared all log levels. If the answer is 'yes', original == your code is correct while my is wrong. In the other case - the situation becomes mirrored. Den