Skip to contentSkip to conversation

xfs_db: reset metadump output flag

PATCH In review Darrick J. Wong 2 participants 2 messages Aug 5, 2017 – Aug 11, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_db: reset metadump output flag

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

---
 db/metadump.c |    1 +
 1 file changed, 1 insertion(+)
db/metadump.c +1 -0
index b242548..c179480 100644
@@ -3058,6 +3058,7 @@ metadump_f(
 		ret = dup2(outfd, STDOUT_FILENO);
 		if (ret < 0)
 			perror("un-redirecting stdout");
+		stdout_metadump = false;
 	}
 	fclose(outf);
 
#1 lore raw
Quoted 7 lines · Darrick J. Wong

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

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