source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Oops, sorry, revert previous and commit the correct patch: At
@ 2014-04-15 23:51 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-04-15 23:51 UTC (permalink / raw)
  To: source

Log Message:
-----------
Oops, sorry, revert previous and commit the correct patch:
At the end of mansearch(), fchdir() back to where we started from.

Modified Files:
--------------
    mdocml:
        mansearch.c

Revision Data
-------------
Index: mansearch.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mansearch.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -Lmansearch.c -Lmansearch.c -u -p -r1.29 -r1.30
--- mansearch.c
+++ 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);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-04-15 23:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15 23:51 mdocml: Oops, sorry, revert previous and commit the correct patch: At schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).