From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=L18ABYKT; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 80C535A0284 for ; Thu, 29 May 2025 19:09:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748538543; 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=viRTRQlFVDChq3hLILAPjMLaeH2Ki2+SwUIxSISuQG0=; b=L18ABYKTohkEFAvdMeGmnFuSTUcnwDPxCNbTbHS/c+Iy5J+sPMlRQgLvAWa1M1B4il2zpQ wo9rETUJnN/24tdTWv4265GB4VQA/106m4wOXe722G9E8kZe4kIdG+VyhNkv4vb6osG/Xf qLZw8YcCiesCMWxJ8JRvz1kvSCVBvBU= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-597-Zb8mkTT6OgGFzVdCtfCB7A-1; Thu, 29 May 2025 13:09:02 -0400 X-MC-Unique: Zb8mkTT6OgGFzVdCtfCB7A-1 X-Mimecast-MFC-AGG-ID: Zb8mkTT6OgGFzVdCtfCB7A_1748538541 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4665C19560AD for ; Thu, 29 May 2025 17:09:01 +0000 (UTC) Received: from jmaloy-thinkpadp16vgen1.rmtcaqc.csb (unknown [10.22.88.62]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EC8341954191; Thu, 29 May 2025 17:08:59 +0000 (UTC) From: Jon Maloy To: sbrivio@redhat.com, dgibson@redhat.com, jmaloy@redhat.com, passt-dev@passt.top Subject: conf: flush stdout before early exit Date: Thu, 29 May 2025 13:08:58 -0400 Message-ID: <20250529170858.185281-1-jmaloy@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: EXK1RdBI6-loRgNS8y73DVsyST-d9R__pf880Vshgv4_1748538541 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: WETV3HTTBHXYH3ZSBOCNXTS2VXACRRUU X-Message-ID-Hash: WETV3HTTBHXYH3ZSBOCNXTS2VXACRRUU X-MailFrom: jmaloy@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Before doing an early exit any contents of stdout is normally flushed. This doesn't happen when the output goes into a pipe and we return with _exit(). We now add an explicit flush in such cases. Fixes: d0006fa784a7 ("treewide: use _exit() over exit()") Signed-off-by: Jon Maloy --- conf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conf.c b/conf.c index a6d7e22..a1d55a3 100644 --- a/conf.c +++ b/conf.c @@ -975,6 +975,7 @@ static void usage(const char *name, FILE *f, int status) " SPEC is as described for TCP above\n" " default: none\n"); + fflush(f); _exit(status); pasta_opts: @@ -1029,6 +1030,7 @@ pasta_opts: " --ns-mac-addr ADDR Set MAC address on tap interface\n" " --no-splice Disable inbound socket splicing\n"); + fflush(f); _exit(status); } @@ -1594,6 +1596,7 @@ void conf(struct ctx *c, int argc, char **argv) FPRINTF(stdout, c->mode == MODE_PASTA ? "pasta " : "passt "); FPRINTF(stdout, VERSION_BLOB); + fflush(stdout); _exit(EXIT_SUCCESS); case 15: ret = snprintf(c->ip4.ifname_out, -- 2.48.1