From nobody Sun Dec 18 02:55:26 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NZSBQ694Hzt7FW for ; Sun, 18 Dec 2022 02:55:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NZSBQ481bz3xm2 for ; Sun, 18 Dec 2022 02:55:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671332126; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=B88q0LRKwuCRcDo/IMhs1tCFRaV2FzIz+LOlVBVrGPM=; b=W3RZNgkrZOPxwoVLxlP3xCmw1HPTH1oFY+D2NLE6yQTanLphyjLEI9QRfi1uRk9btbDP/L dpNim2uN4Eh6T/H5RGe/5+zhwlCHk6temQ8SDuXqLwGfQQLiEVkaDo+knbd4E1afm5PkY6 IK5QWEOLFWsF92oqUVoH/GCfJOftCKG48fSc69cDLVqyZO0zq3wZtCNd6HS667AWAaHxHA LkxpNdrV7LblIN/AETP3stDXQkRy4sleopzNXu3LEQ1CYs1D+FWNOre+gJg3UsNfNjzgwP uYjvtPXisXW1Vsf93oc0+F01yTwuVrZ7x6t5YY3OI8r6F+b1ZmLxxD2OlOam9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671332126; a=rsa-sha256; cv=none; b=UgruzkI8IHz2HsDdCVVtC5l2KywkELwuhlqgIOAJTx5Dps4rn7V0tfVN2rhL1W9o1mBPnA /476HpHuQlf1CmFR0RgBQydVunE+RDSL2EhI2bVUiISjDR/vb72sQ2emU/wxSC1rZYvqHh DpOb7gr2gYiAX21Cf10soeCY8LuWvWSaeYETIidnCoy3AWs3N/vN8RFCf7Nkj7FleEfNS/ iNe6ACv50/pPAvbGfElSjb3lBUE6HxG/OpBNpPlipUTonqzu4v4Mv4yUJhqIAu04ys3Ebg sX/AHtX9rUtcHSfLlII+Oz++arOLMSEpVOZWt7BYUXf6h69B3LIKzM+8Uv2Dgg== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NZSBQ3Bv1z1FZx for ; Sun, 18 Dec 2022 02:55:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 2BI2tQoB023487 for ; Sun, 18 Dec 2022 02:55:26 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 2BI2tQSJ023486 for bugs@FreeBSD.org; Sun, 18 Dec 2022 02:55:26 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 268436] [libc] syslog() and vsyslog() do not preserve the errno at the time of the call. Date: Sun, 18 Dec 2022 02:55:26 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: hodong@nimfsoft.art X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268436 Bug ID: 268436 Summary: [libc] syslog() and vsyslog() do not preserve the errno at the time of the call. Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: hodong@nimfsoft.art Hello. Since syslog() and vsyslog() do not preserve errno at the time of the call, errno may change after calling syslog. https://cgit.freebsd.org/src/tree/lib/libc/gen/syslog.c https://github.com/freebsd/freebsd-src/blob/main/lib/libc/gen/syslog.c I suggest this patch. --- a/syslog.c +++ b/syslog.c @@ -348,7 +348,9 @@ vsyslog(int pri, const char *fmt, va_list ap) THREAD_LOCK(); pthread_cleanup_push(syslog_cancel_cleanup, NULL); + int saved_errno =3D errno; vsyslog1(pri, fmt, ap); + errno =3D saved_errno; pthread_cleanup_pop(1); } --=20 You are receiving this mail because: You are the assignee for the bug.=