From patchwork Tue Nov 1 15:28:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 13027113 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6B5AFC4332F for ; Tue, 1 Nov 2022 15:29:19 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.434833.687494 (Exim 4.92) (envelope-from ) id 1optCR-00009J-4F; Tue, 01 Nov 2022 15:29:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 434833.687494; Tue, 01 Nov 2022 15:29:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1optCR-000094-0j; Tue, 01 Nov 2022 15:29:11 +0000 Received: by outflank-mailman (input) for mailman id 434833; Tue, 01 Nov 2022 15:29:09 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1optCP-0007Tl-DS for xen-devel@lists.xenproject.org; Tue, 01 Nov 2022 15:29:09 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ed91d5d7-59f9-11ed-91b5-6bf2151ebd3b; Tue, 01 Nov 2022 16:29:08 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 818151F8E3; Tue, 1 Nov 2022 15:29:08 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 58D0B1346F; Tue, 1 Nov 2022 15:29:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IcyBFEQ7YWOlYAAAMHmgww (envelope-from ); Tue, 01 Nov 2022 15:29:08 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ed91d5d7-59f9-11ed-91b5-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1667316548; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kI1Emp5xZULnpO1cGT8dYHVyoLvYXhzW8MdJFPz/OVo=; b=f+5YMk/mhCQx9Q20fUu9M/tLuSwPFGVsS8ZSkbQN1Wh2FhBWbY6fnFKbCVLOJfd6Ux6rCG 0URdb6sg6n09kSXpJK2vBV3QLHAjaUquslVDFAaSI2pKnyJ4TnxV9/QOuoG0OhS5dgzw8d NNt0R2+HG5nVWdCQ6NSIF/DT3Daft60= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Julien Grall , Anthony PERARD Subject: [PATCH 04/20] tools/xenstore: let tdb_logger() preserve errno Date: Tue, 1 Nov 2022 16:28:26 +0100 Message-Id: <20221101152842.4257-5-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221101152842.4257-1-jgross@suse.com> References: <20221101152842.4257-1-jgross@suse.com> MIME-Version: 1.0 tdb_logger() is called by TDB for logging errors. As errno is checked often after doing the logging, tdb_logger() should preserve errno. Signed-off-by: Juergen Gross Reviewed-by: Julien Grall --- tools/xenstore/xenstored_core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index 5a174b9881..d48208ecfe 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -2345,6 +2345,7 @@ static void tdb_logger(TDB_CONTEXT *tdb, int level, const char * fmt, ...) { va_list ap; char *s; + int saved_errno = errno; va_start(ap, fmt); s = talloc_vasprintf(NULL, fmt, ap); @@ -2360,6 +2361,8 @@ static void tdb_logger(TDB_CONTEXT *tdb, int level, const char * fmt, ...) trace("talloc failure during logging\n"); syslog(LOG_ERR, "talloc failure during logging\n"); } + + errno = saved_errno; } void setup_structure(bool live_update)