xfs
[Top] [All Lists]

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

To: xfs@xxxxxxxxxxx
Subject: [PATCH 1/9] xfsdump: don't try to close fd from failed open
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Wed, 12 Nov 2014 12:57:10 -0600
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1415818638-32700-1-git-send-email-sandeen@xxxxxxxxxx>
References: <1415818638-32700-1-git-send-email-sandeen@xxxxxxxxxx>
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@xxxxxxxxxx>
---
 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

<Prev in Thread] Current Thread [Next in Thread>