You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2016/08/27 15:33:39 UTC

[trafficserver] branch master updated: TS-4779: Fix CID 1361961 - Check return value on safe_fcntl()

This is an automated email from the ASF dual-hosted git repository.

sorber pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  f77d29a   TS-4779: Fix CID 1361961 - Check return value on safe_fcntl()
f77d29a is described below

commit f77d29a51abbeab081a9f8d5506ec322ede89541
Author: Phil Sorber <so...@apache.org>
AuthorDate: Sat Aug 27 09:32:14 2016 -0600

    TS-4779: Fix CID 1361961 - Check return value on safe_fcntl()
---
 lib/ts/ink_sock.cc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/ts/ink_sock.cc b/lib/ts/ink_sock.cc
index b88a110..7621f21 100644
--- a/lib/ts/ink_sock.cc
+++ b/lib/ts/ink_sock.cc
@@ -288,8 +288,13 @@ bind_unix_domain_socket(const char *path, mode_t mode)
   socklen = strlen(sockaddr.sun_path) + sizeof(sockaddr.sun_family);
 #endif
 
-  safe_setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, SOCKOPT_ON, sizeof(int));
-  safe_fcntl(sockfd, F_SETFD, FD_CLOEXEC);
+  if (safe_setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, SOCKOPT_ON, sizeof(int)) < 0) {
+    goto fail;
+  }
+
+  if (safe_fcntl(sockfd, F_SETFD, FD_CLOEXEC) < 0) {
+    goto fail;
+  }
 
   if (bind(sockfd, (struct sockaddr *)&sockaddr, socklen) < 0) {
     goto fail;

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].