In gcc version 4.3.2 we get warnings for functions declared with
authorJeremy Allison <jeremy@jeremy-desktop.(none)>
Tue, 23 Dec 2008 04:08:14 +0000 (20:08 -0800)
committerJeremy Allison <jeremy@jeremy-desktop.(none)>
Tue, 23 Dec 2008 04:08:14 +0000 (20:08 -0800)
attribute warn_unused_result. Start to fix these.
Jeremy.

lib/socket_wrapper/socket_wrapper.c
source3/libnet/libnet_join.c

index 9d619769507792cef1984f36b20e67539180dd93..dc0124bdb7720572a040ecfe6ce4e1fa540a52f6 100644 (file)
@@ -899,7 +899,10 @@ static int swrap_get_pcap_fd(const char *fname)
                file_hdr.frame_max_len  = SWRAP_FRAME_LENGTH_MAX;
                file_hdr.link_type      = 0x0065; /* 101 RAW IP */
 
-               write(fd, &file_hdr, sizeof(file_hdr));
+               if (write(fd, &file_hdr, sizeof(file_hdr)) != sizeof(file_hdr)) {
+                       close(fd);
+                       return -1;
+               }
                return fd;
        }
 
@@ -1190,7 +1193,12 @@ static void swrap_dump_packet(struct socket_info *si,
 
        fd = swrap_get_pcap_fd(file_name);
        if (fd != -1) {
-               write(fd, packet, packet_len);
+               if (write(fd, packet, packet_len) != packet_len) {
+                       close(fd);
+                       free(packet);
+                       return;
+               }
+               close(fd);
        }
 
        free(packet);
index 691f6ff8ebb7038d57b8373e6d49385c8c687a51..51d979074b65ba99b8594bb004d6ca51bd01a735 100644 (file)
@@ -1019,8 +1019,7 @@ NTSTATUS libnet_join_ok(const char *netbios_domain_name,
                return NT_STATUS_NO_TRUST_LSA_SECRET;
        }
 
-       asprintf(&machine_account, "%s$", machine_name);
-       if (!machine_account) {
+       if (asprintf(&machine_account, "%s$", machine_name) == -1) {
                SAFE_FREE(machine_password);
                return NT_STATUS_NO_MEMORY;
        }