xfs_db: reset metadump output flag
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
Signed-off-by Darrick J. Wong <[email protected]>
--- db/metadump.c | 1 + 1 file changed, 1 insertion(+)
db/metadump.c +1 -0
@@ -3058,6 +3058,7 @@ metadump_f( ret =dup2 (outfd,STDOUT_FILENO );if (ret <0 )perror ("un-redirecting stdout" ); + stdout_metadump = false; }fclose (outf);
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_metadumpvariable 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 <[email protected]>
Looks good. Seems like something we could even write a test case for :)