Fix more "ignore return value" warnings from gcc 4.3.
authorJeremy Allison <jra@samba.org>
Wed, 31 Dec 2008 01:52:08 +0000 (17:52 -0800)
committerJeremy Allison <jra@samba.org>
Wed, 31 Dec 2008 01:52:08 +0000 (17:52 -0800)
Jeremy

source/libads/kerberos_verify.c
source/smbd/server.c
source/web/cgi.c
source/web/neg_lang.c
source/web/swat.c

index c66718164272a757482971d83286e67e159cc9a6..de3fdeb9de6cdcd81bd78e6820453280d867f75c 100644 (file)
@@ -69,13 +69,27 @@ static bool ads_keytab_verify_ticket(krb5_context context,
        my_fqdn[0] = '\0';
        name_to_fqdn(my_fqdn, global_myname());
 
-       asprintf(&valid_princ_formats[0], "%s$@%s", my_name, lp_realm());
-       asprintf(&valid_princ_formats[1], "host/%s@%s", my_name, lp_realm());
-       asprintf(&valid_princ_formats[2], "host/%s@%s", my_fqdn, lp_realm());
-       asprintf(&valid_princ_formats[3], "host/%s.%s@%s", my_name, lp_realm(), lp_realm());
-       asprintf(&valid_princ_formats[4], "cifs/%s@%s", my_name, lp_realm());
-       asprintf(&valid_princ_formats[5], "cifs/%s@%s", my_fqdn, lp_realm());
-       asprintf(&valid_princ_formats[6], "cifs/%s.%s@%s", my_name, lp_realm(), lp_realm());
+       if (asprintf(&valid_princ_formats[0], "%s$@%s", my_name, lp_realm()) == -1) {
+               goto out;
+       }
+       if (asprintf(&valid_princ_formats[1], "host/%s@%s", my_name, lp_realm()) == -1) {
+               goto out;
+       }
+       if (asprintf(&valid_princ_formats[2], "host/%s@%s", my_fqdn, lp_realm()) == -1) {
+               goto out;
+       }
+       if (asprintf(&valid_princ_formats[3], "host/%s.%s@%s", my_name, lp_realm(), lp_realm()) == -1) {
+               goto out;
+       }
+       if (asprintf(&valid_princ_formats[4], "cifs/%s@%s", my_name, lp_realm()) == -1) {
+               goto out;
+       }
+       if (asprintf(&valid_princ_formats[5], "cifs/%s@%s", my_fqdn, lp_realm()) == -1) {
+               goto out;
+       }
+       if (asprintf(&valid_princ_formats[6], "cifs/%s.%s@%s", my_name, lp_realm(), lp_realm()) == -1) {
+               goto out;
+       }
 
        ZERO_STRUCT(kt_entry);
        ZERO_STRUCT(kt_cursor);
@@ -375,8 +389,7 @@ NTSTATUS ads_verify_ticket(TALLOC_CTX *mem_ctx,
                krb5_auth_con_setflags( context, auth_context, flags );
        }
 
-       asprintf(&host_princ_s, "%s$", global_myname());
-       if (!host_princ_s) {
+       if (asprintf(&host_princ_s, "%s$", global_myname()) == -1) {
                goto out;
        }
 
index c04ae6fd81d57728ebc79a2136458e715f00b8f0..4f475176a93b6968af0e141d62e5f3154f393944 100644 (file)
@@ -59,6 +59,7 @@ int get_client_fd(void)
        return server_fd;
 }
 
+#ifdef CLUSTER_SUPPORT
 static int client_get_tcp_info(struct sockaddr_storage *server,
                               struct sockaddr_storage *client)
 {
@@ -76,6 +77,7 @@ static int client_get_tcp_info(struct sockaddr_storage *server,
        }
        return 0;
 }
+#endif
 
 struct event_context *smbd_event_context(void)
 {
index bcb4ccd813854a52227ea38efb37367705caaad1..015f9d1ef79691e4c234abeeb3aaaa43fbe9cde4 100644 (file)
@@ -497,7 +497,9 @@ static void cgi_download(char *file)
 
        printf("Content-Length: %d\r\n\r\n", (int)st.st_size);
        while ((l=read(fd,buf,sizeof(buf)))>0) {
-               fwrite(buf, 1, l, stdout);
+               if (fwrite(buf, 1, l, stdout) != l) {
+                       break;
+               }
        }
        close(fd);
        exit(0);
index 82411000cd1e8d806e8d98cb2b634d6a19ed2f2d..f46eb0dab1a7297964f806a7482b3b9de2e4483b 100644 (file)
@@ -32,8 +32,7 @@ int web_open(const char *fname, int flags, mode_t mode)
        char *lang = lang_tdb_current();
        int fd;
        if (lang) {
-               asprintf(&p, "lang/%s/%s", lang, fname);
-               if (p) {
+               if (asprintf(&p, "lang/%s/%s", lang, fname) != -1) {
                        fd = sys_open(p, flags, mode);
                        free(p);
                        if (fd != -1) {
index 1502c5bc2f13519daef3016f42c9a3071398d8d3..c5bafb174d10a68331f77ebd0c51b4edd7a1d2ba 100644 (file)
@@ -156,7 +156,9 @@ static int include_html(const char *fname)
        }
 
        while ((ret = read(fd, buf, sizeof(buf))) > 0) {
-               write(1, buf, ret);
+               if (write(1, buf, ret) == -1) {
+                       break;
+               }
        }
 
        close(fd);
@@ -1252,8 +1254,8 @@ static void printers_page(void)
         printf("<H2>%s</H2>\n", _("Printer Parameters"));
  
         printf("<H3>%s</H3>\n", _("Important Note:"));
-        printf(_("Printer names marked with [*] in the Choose Printer drop-down box "));
-        printf(_("are autoloaded printers from "));
+        printf("%s",_("Printer names marked with [*] in the Choose Printer drop-down box "));
+        printf("%s",_("are autoloaded printers from "));
         printf("<A HREF=\"/swat/help/smb.conf.5.html#printcapname\" target=\"docs\">%s</A>\n", _("Printcap Name"));
         printf("%s\n", _("Attempting to delete these printers from SWAT will have no effect."));