=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mansearch.c,v retrieving revision 1.19 retrieving revision 1.20 diff -c -r1.19 -r1.20 *** src/usr.bin/mandoc/mansearch.c 2014/04/11 15:45:39 1.19 --- src/usr.bin/mandoc/mansearch.c 2014/04/15 23:47:57 1.20 *************** *** 1,4 **** ! /* $Id: mansearch.c,v 1.19 2014/04/11 15:45:39 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * Copyright (c) 2013, 2014 Ingo Schwarze --- 1,4 ---- ! /* $Id: mansearch.c,v 1.20 2014/04/15 23:47:57 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * Copyright (c) 2013, 2014 Ingo Schwarze *************** *** 202,208 **** */ if (NULL == getcwd(buf, PATH_MAX)) { ! perror(NULL); goto out; } else if (-1 == (fd = open(buf, O_RDONLY, 0))) { perror(buf); --- 202,208 ---- */ if (NULL == getcwd(buf, PATH_MAX)) { ! perror("getcwd"); goto out; } else if (-1 == (fd = open(buf, O_RDONLY, 0))) { perror(buf); *************** *** 339,347 **** } rc = 1; out: ! exprfree(e); ! if (-1 != fd) close(fd); free(sql); *sz = cur; return(rc); --- 339,350 ---- } rc = 1; out: ! if (-1 != fd) { ! if (-1 == fchdir(fd)) ! perror(buf); close(fd); + } + exprfree(e); free(sql); *sz = cur; return(rc);