diff options
Diffstat (limited to 'mansearch.c')
-rw-r--r-- | mansearch.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mansearch.c b/mansearch.c index b84295ae..8918f1d1 100644 --- a/mansearch.c +++ b/mansearch.c @@ -210,7 +210,7 @@ mansearch(const struct mansearch *search, */ if (NULL == getcwd(buf, PATH_MAX)) { - perror(NULL); + perror("getcwd"); goto out; } else if (-1 == (fd = open(buf, O_RDONLY, 0))) { perror(buf); @@ -218,7 +218,6 @@ mansearch(const struct mansearch *search, } sql = sql_statement(e); - printf("%s\n", sql); /* * Loop over the directories (containing databases) for us to @@ -348,9 +347,12 @@ mansearch(const struct mansearch *search, } rc = 1; out: - exprfree(e); - if (-1 != fd) + if (-1 != fd) { + if (-1 == fchdir(fd)) + perror(buf); close(fd); + } + exprfree(e); free(sql); *sz = cur; return(rc); |