[PATCH 1/9] xfsdump: don't try to close fd from failed open

Eric Sandeen sandeen at redhat.com
Wed Nov 12 12:57:10 CST 2014


I was going to just return if open() fails, but realized that
failing ioctls on the not-opened fd are ... maybe intentional?
By trying to run the ioctls on the invalid fd, it actually spits
useful error messages to the log, so...

Signed-off-by: Eric Sandeen <sandeen at redhat.com>
---
 restore/tree.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/restore/tree.c b/restore/tree.c
index 08e177f..fda4fc5 100644
--- a/restore/tree.c
+++ b/restore/tree.c
@@ -2626,7 +2626,8 @@ setdirattr( dah_t dah, char *path )
 		     path,
 		     strerror(errno));
 	}
-	( void )close( fd );
+	if (fd >= 0)
+		close( fd );
 }
 
 /* deletes orphanage if empty, else warns
-- 
1.7.1



More information about the xfs mailing list