Print this page
10108 libstmfproxy needs smatch fixes

@@ -21,10 +21,14 @@
 /*
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
+/*
+ * Copyright (c) 2018, Joyent, Inc.
+ */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h>
 #include <sys/types.h>

@@ -119,11 +123,11 @@
                         goto serv_out;
                 }
                 sh = malloc(sizeof (*sh));
                 sh->sockfd = new_sfd;
 serv_out:
-                close(sfd);
+                (void) close(sfd);
         } else {
                 struct  hostent *hp;
 
                 /*
                  * Assume IP dot notation or if that fails, gethostbyname()

@@ -149,20 +153,20 @@
                 /* XXX pass in from smf */
                 sin.sin_port = htons(6543);
 
                 while (connect(sfd, (struct sockaddr *)&sin,
                     sizeof (sin)) < 0) {
-                        close(sfd);
+                        (void) close(sfd);
                         if (errno == ECONNREFUSED) {
                                 /* get a fresh socket and retry */
                                 sfd = socket(AF_INET, SOCK_STREAM, 0);
                                 if (sfd < 0) {
                                         syslog(LOG_DAEMON|LOG_WARNING,
                                             "socket() call failed: %d", errno);
                                         return (NULL);
                                 }
-                                sleep(2);
+                                (void) sleep(2);
                         } else {
                                 syslog(LOG_DAEMON|LOG_CRIT,
                                     "Cannot connect %s - %d", server, errno);
                                 return (NULL);
                         }