X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Frealpath.c;h=592e12c706cd50519e8f81cea90d71a726477b64;hb=5a50c04906828f6e99db6a9be420c84114476d39;hp=607381b81963bf817e896f505a3cc97dc87f4ffb;hpb=5ce759bfdc70c97121ef34ab4d5c918d568f2474;p=libguestfs.git diff --git a/daemon/realpath.c b/daemon/realpath.c index 607381b..592e12c 100644 --- a/daemon/realpath.c +++ b/daemon/realpath.c @@ -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; }