X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Frealpath.c;h=ea936c6ac4e689966a60e6967edbc823d2be576b;hb=7d3848ddc046f79cc1112809bd9970eea8060018;hp=607381b81963bf817e896f505a3cc97dc87f4ffb;hpb=5ce759bfdc70c97121ef34ab4d5c918d568f2474;p=libguestfs.git diff --git a/daemon/realpath.c b/daemon/realpath.c index 607381b..ea936c6 100644 --- a/daemon/realpath.c +++ b/daemon/realpath.c @@ -13,7 +13,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include @@ -179,7 +179,8 @@ do_case_sensitive_path (const char *path) } } - close (fd_cwd); + if (fd_cwd >= 0) + close (fd_cwd); ret[next] = '\0'; char *retp = strdup (ret); @@ -190,6 +191,8 @@ do_case_sensitive_path (const char *path) return retp; /* caller frees */ error: - close (fd_cwd); + if (fd_cwd >= 0) + close (fd_cwd); + return NULL; }