summaryrefslogtreecommitdiffstats
path: root/bin/rcp
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2007-05-22 04:21:00 +0000
committercperciva <cperciva@FreeBSD.org>2007-05-22 04:21:00 +0000
commite4c186657b8eb555fef2678dd703b9b70546e75b (patch)
tree172e34c792ec8bec7e4e1c08f87f6792125e1e04 /bin/rcp
parentf4c02717048c439a7648aa6f398c10a957e68a71 (diff)
downloadFreeBSD-src-e4c186657b8eb555fef2678dd703b9b70546e75b.zip
FreeBSD-src-e4c186657b8eb555fef2678dd703b9b70546e75b.tar.gz
In the error handling path, don't call close(fd) if the error we're
handling is that fd = open(foo) is -1. This bug is harmless since close(-1) just returns an error (which the code ignores). Found by: Coverity Prevent(tm) CID: 1503 (in userland test run)
Diffstat (limited to 'bin/rcp')
-rw-r--r--bin/rcp/rcp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/rcp/rcp.c b/bin/rcp/rcp.c
index d36f3bd..62d7daf 100644
--- a/bin/rcp/rcp.c
+++ b/bin/rcp/rcp.c
@@ -403,7 +403,8 @@ syserr: run_err("%s: %s", name, strerror(errno));
if (response() < 0)
goto next;
if ((bp = allocbuf(&buffer, fd, BUFSIZ)) == NULL) {
-next: (void)close(fd);
+next: if (fd >= 0)
+ (void)close(fd);
continue;
}
OpenPOWER on IntegriCloud