[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 1/4] common.h: Flush stdout before writing to stderr
- To: Mihails Strasuns <mstrasun@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
- Date: Wed, 8 Feb 2023 18:02:03 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TCRMx2hlHmIpleezg0Gi3bHGWkCCytuSV9ZdPQuj/p8=; b=CVaTov0cos0tYgJweVq9YnVez5S/wGDPEX1qd/IgENRTO/HBWicfNkN29jKSZsSYmfsjJBsH+CajemPcGLTxo2fd5DVRzKGRfWKwN98dWms7DYbOUFIuWdVHIAw6EhatNhNW+EBZMefoUVBky3++5A5ueckKiD+hy9X/b7MiHCPwB2O7sDP3QmhlkFU1Yq4Izu37G2BAe3EWKzf2vehNYOVy8YncoZkJZgkM6jj4qxTMbW5Hrc4iYD+bfuxXIbqJS0v4CAQYgHxzGVfY+ury0Fry9ZpoYofX4I+XM8DfeRsczlf+SC46F1xuwJz03Yqhn/caRE6QmfPyGtRmGj8IQw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EViNpe86MhNEYIf+Q/bcq9112OJm373mHnGgFRvkEnvSSyMPc6ZFH7CXs4TBs/nT0jp/s3BP50meYyoXCnq6IkThgsSlxaNQJr/HQxE31egh3zWsqdgjrMbiy5hmHfJyRzX5/MBRLP0EdlA9hYPzG2c8yZCP8mPT5WHoy321oj37HndUvxnFBLl9aa3bf0A/vdZ2Ljeld4dIFOZXHTzpSbrfvm8BFTV66cC1LHCtFhnlhzVFm354zc+0OSI2exLqDRx1VazSxBUqG8FXV32aGVe4wchE3Vfp8ueoQ4J4m5Z93w2wnOZPxw7b+Uvt3zyirFXREE+bkdqUK3F3Ke7SlA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Michael Kurth <mku@xxxxxxxxxx>
- Delivery-date: Wed, 08 Feb 2023 18:02:53 +0000
- Ironport-data: A9a23:Ok5WyKOaC3z+4jjvrR2MlsFynXyQoLVcMsEvi/4bfWQNrUp0hmcCy mRJXGCGOfmKZDehKoolad/jp0IFu5fWyYM3QAto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CU6jufQAOKnUoYoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGj9Suv3rRC9H5qyo42tC5gxmP5ingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0uNMEVpB1 6QqFC4mMxK4jN3o6aibe8A506zPLOGzVG8ekldJ6GmDSM0AGNXESaiM4sJE1jAtgMwIBezZe 8cSdTtoalLHfgFLPVAUTpk5mY9EhFGmK2Ee9A3T+PVxvza7IA9ZidABNPLPfceRA8FckUuCu WvC+0zyAw0ANczZwj2Amp6prr6SxXyqAN5PfFG+3uNXvg2im2oLMzoTVgK3rKjio0rvYt0Kf iT4/QJr98De7neDS8LhRRSjvXistxsVSd1WVeY97Wml2qfSpgqUGGUAZjpAc8A98t87QyQw0 V2ElM+vAiZg2JWQSm+1/7KdvzS0fyMSKAc/iTQsSAIE55z4ptg1hxeXFNJ7Svbp0JvyBC36x C2MoG4mnbIPgMUX1qK9u1fanzaroZuPRQkwjunKYl+YAspCTNbNT+SVBZLztJ6s8K7xooG9g UU5
- Ironport-hdrordr: A9a23:Ip0RDqHLB3jZ7Gj+pLqE0seALOsnbusQ8zAXPhZKOHtom6uj5q OTdZUgtSMc5wx7ZJhNo7q90cq7IE80l6Qb3WBLB8bHYOCOggLBEGgF1+bfKlbbdREWmNQw6U /OGZIObuEZoTJB/KTHCKjTKadE/OW6
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Msip_labels:
- Thread-index: AQHZK+7uzgs/uPURN0KVH9/bFkDof67Fdcqe
- Thread-topic: [PATCH v1 1/4] common.h: Flush stdout before writing to stderr
> From: Xen-devel <xen-devel-bounces@xxxxxxxxxxxxxxxxxxxx> on behalf of Mihails
> Strasuns <mstrasun@xxxxxxxxxx>
> Sent: Thursday, January 19, 2023 10:13 AM
> To: xen-devel@xxxxxxxxxxxxxxxxxxxx <xen-devel@xxxxxxxxxxxxxxxxxxxx>
> Cc: mstrasun@xxxxxxxxxx <mstrasun@xxxxxxxxxx>; Michael Kurth <mku@xxxxxxxxxx>
> Subject: [PATCH v1 1/4] common.h: Flush stdout before writing to stderr
>
> Flush existing debug messages before writing an error to stderr. stderr
> is usually unbuffered and stdout is usually buffered. This results in
> odd looking output when an error occurs and both stderr/stdout are
> printed on the same console/file. More precisely, the error message is
> printed in the middle of previously emitted debug messages.
>
> Signed-off-by: Michael Kurth <mku@xxxxxxxxxx>
> ---
> common.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/common.h b/common.h
> index 02c9b7b..9a9da79 100644
> --- a/common.h
> +++ b/common.h
> @@ -10,6 +10,7 @@ extern char *childobj;
>
> #define DIFF_FATAL(format, ...) \
> ({ \
> + fflush(stdout); \
> fprintf(stderr, "ERROR: %s: " format "\n", childobj, ##__VA_ARGS__);
> \
> error(2, 0, "unreconcilable difference"); \
> })
> --
> 2.38.1
Reviewed-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
|