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=gmMnHlSZ; 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 92F435A0280 for ; Fri, 30 May 2025 10:08:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748592490; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NpP4ynz8iJoxj5mTyNi+sVNIPoxnzai9jBrvzM4OKMc=; b=gmMnHlSZdcbqNhD1C8CuXJi5izEQHaFXwdo8W+2qJngqtCLoPbFUHR4iVi0owHM12LWQxM BLhxn0g53meaIPPQTL1NWJh/3OEdpcInW55utPJHLA6+2wGjCZKPXzWQi2aAyg5Glu+Bqr ebC9qAx1BDpb2HL28oTkZCAoQVThjs4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-691-E-zipOrSOlONXaX7sIUjaw-1; Fri, 30 May 2025 04:08:09 -0400 X-MC-Unique: E-zipOrSOlONXaX7sIUjaw-1 X-Mimecast-MFC-AGG-ID: E-zipOrSOlONXaX7sIUjaw_1748592488 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3a4f7ebfd00so259821f8f.2 for ; Fri, 30 May 2025 01:08:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748592488; x=1749197288; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=NpP4ynz8iJoxj5mTyNi+sVNIPoxnzai9jBrvzM4OKMc=; b=b58v1RKTgVuE/P8tcn6x555/ns+JtF1gbrm5FqYI44NUcxmc5KO4mYc9sIlfWUD643 J7R5IXx0xyUV9AN34CK4npIU288kF8hmizBGm1YbMPWRSdaz0M9D3tHzJDImd+ldb/ML dHvfr6LtvjIXfjWetXQrdtifH8pPtt7gCcNjzjJkgl5pAqsGfwj2WtuSRVoniRG0ICDw JItTpXhp5CMjF31cH5Xap48vt3C83inj/PoJ5B1Muk24VPrAjexTzBxSVcKWbDENlE1w G89gFGRdzSmKzcb/bPHiMEdqktkkWg8xUv2icP24mINK6OCEy5E7NxNQs22X+S15X5vZ bepg== X-Forwarded-Encrypted: i=1; AJvYcCWAJrVEa3Vdz8GOOzujLKHdzZUzErbXwmnF7t3Vr5ygPd+XF6nVlbJFP3NFfAjzgldieXq/ZLba2yk=@passt.top X-Gm-Message-State: AOJu0Yyt+kTzxK4LmL/8/k8Bqg7ahJ8Jf0qt6HX/5Lf27dRcUW1suKVo DiE/szW38y7dmc6UdOLshIuokQpjbgAtD5lh/XVjMtWTz18eVHz+ZMSsjxM5UUziCOC2P8MkKK0 mBvhzxFOj/ddpa6ltBvNpPIVRZJVPoQxtSoGuENAgtO7lP1teDTje5w== X-Gm-Gg: ASbGncvjcD+Lw/vK7OP8SeWcsi5Oc++dNkD1I1Z24IuKrOJaOztsHeesZ9ShJkYa6kn UBhfqRZ3EZDYVNR6HGqkrrnhE9Fw68vsR5gstC/oRW6sWsDqEdzEOGBJLubcz1XFUcVjFMmI4cr Iw6frpwl5PGg0IY/1UKIrKNoyXPo1MpRgDdB1PAwTJlHy0gZa0wi+0IZNQBdF+dIFOWhxi7nmml 267h/E7JxKTNDlVztmt1f+XmfI4KD8mPEGjTynm9JlVBv2y96AZV5dwMn0sWmVNxYIN0fY5xUPZ 65YBqAxuKfw4EB4RKvEsPJgs58syHP2rMCbl12DU X-Received: by 2002:a05:6000:250d:b0:3a4:f50b:ca2 with SMTP id ffacd0b85a97d-3a4f7a3c953mr1544220f8f.8.1748592487873; Fri, 30 May 2025 01:08:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGoCIy87uxet7hUx4axSwTGyVZg3X1ts86X0jOK9lBR0Ust1khjafb+YbOmofst5vQYsrt6Vg== X-Received: by 2002:a05:6000:250d:b0:3a4:f50b:ca2 with SMTP id ffacd0b85a97d-3a4f7a3c953mr1544186f8f.8.1748592487451; Fri, 30 May 2025 01:08:07 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-44fcbd6217fsm70247465e9.0.2025.05.30.01.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 May 2025 01:08:07 -0700 (PDT) Date: Fri, 30 May 2025 10:08:05 +0200 From: Stefano Brivio To: Jon Maloy Subject: Re: conf: flush stdout before early exit Message-ID: <20250530100805.43921b27@elisabeth> In-Reply-To: <20250529170858.185281-1-jmaloy@redhat.com> References: <20250529170858.185281-1-jmaloy@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: LBqKh_yGuV6vgl3onLfY4FxyKYiSe71NEoLOsBVUyvs_1748592488 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: ZR5B6VIPQRHHEXT6NVDZQV5TP2CUF53G X-Message-ID-Hash: ZR5B6VIPQRHHEXT6NVDZQV5TP2CUF53G X-MailFrom: sbrivio@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 CC: dgibson@redhat.com, passt-dev@passt.top, Paul Holzinger , "John Radley (jradxl2)" 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: Thanks for the patch! Cc'ing with full quote for review Paul as author of d0006fa784a7, and John as reporter of the issue. On Thu, 29 May 2025 13:08:58 -0400 Jon Maloy wrote: > 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, -- Stefano