public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_db: reset metadump output flag
@ 2017-08-05 16:10 Darrick J. Wong
  2017-08-11 11:24 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2017-08-05 16:10 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs

On the off chance that someone runs metadump more than once with the
metadump file going to stdout and then not stdout, the stdout_metadump
variable will not be reset before the second invocation.  Clear the
status variable when we undo the stdout redirection.

Fixes-coverity-id: 1416140
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 db/metadump.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/db/metadump.c b/db/metadump.c
index b242548..c179480 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -3058,6 +3058,7 @@ metadump_f(
 		ret = dup2(outfd, STDOUT_FILENO);
 		if (ret < 0)
 			perror("un-redirecting stdout");
+		stdout_metadump = false;
 	}
 	fclose(outf);
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs_db: reset metadump output flag
  2017-08-05 16:10 [PATCH] xfs_db: reset metadump output flag Darrick J. Wong
@ 2017-08-11 11:24 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2017-08-11 11:24 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Eric Sandeen, xfs

On Sat, Aug 05, 2017 at 09:10:13AM -0700, Darrick J. Wong wrote:
> On the off chance that someone runs metadump more than once with the
> metadump file going to stdout and then not stdout, the stdout_metadump
> variable will not be reset before the second invocation.  Clear the
> status variable when we undo the stdout redirection.
> 
> Fixes-coverity-id: 1416140
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good.  Seems like something we could even write a test case for :)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-11 11:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-05 16:10 [PATCH] xfs_db: reset metadump output flag Darrick J. Wong
2017-08-11 11:24 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox