diff options
Diffstat (limited to 'io/fts.c')
-rw-r--r-- | io/fts.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/io/fts.c b/io/fts.c index 4ce6527441..cf52d9e299 100644 --- a/io/fts.c +++ b/io/fts.c @@ -231,6 +231,7 @@ fts_close(sp) { register FTSENT *freep, *p; int saved_errno; + int retval = 0; /* * This still works if we haven't read anything -- the dummy structure @@ -259,15 +260,16 @@ fts_close(sp) (void)__close(sp->fts_rfd); } - /* Free up the stream pointer. */ - free(sp); - /* Set errno and return. */ if (!ISSET(FTS_NOCHDIR) && saved_errno) { __set_errno (saved_errno); - return (-1); + retval = -1; } - return (0); + + /* Free up the stream pointer. */ + free (sp); + + return retval; } /* |