X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Frealpath.c;h=ff258beec9baffafc62f60864327aa10bf84f200;hb=830a2d29d9b3f13bef2455c9446eb4eadb444ca7;hp=89f77378d432b05c4bcfe01906ffcd5987847b50;hpb=e9c37113104c1cfb234535adc9b52ad3880a41ce;p=libguestfs.git diff --git a/daemon/realpath.c b/daemon/realpath.c index 89f7737..ff258be 100644 --- a/daemon/realpath.c +++ b/daemon/realpath.c @@ -183,7 +183,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); @@ -194,6 +195,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; }