diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-06-08 22:04:25 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-06-09 10:53:22 +0100 |
commit | 76dfb74324fa0daa343d7edf89bd05e1fe7b4db0 (patch) | |
tree | 412a338701814f62eea11fe17695020d9fbe5dcc /daemon | |
parent | 3ed8d5122026f37dd96cc7e8503c4f3ecf0afbb7 (diff) | |
download | libguestfs-76dfb74324fa0daa343d7edf89bd05e1fe7b4db0.tar.gz libguestfs-76dfb74324fa0daa343d7edf89bd05e1fe7b4db0.tar.xz libguestfs-76dfb74324fa0daa343d7edf89bd05e1fe7b4db0.zip |
Coverity: Don't close fd_cwd if fd_cwd == -1.
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/realpath.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/daemon/realpath.c b/daemon/realpath.c index 607381b8..592e12c7 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; } |