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

source3/libads/kerberos_verify.c
source3/web/cgi.c
source3/web/neg_lang.c
source3/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 49e83717c3d7f0a6c0c2691ca61a9fad3ea49c6a..40f9ee69668b8f36d2232e5216b73dcee7480817 100644 (file)
@@ -498,7 +498,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 491ca9eedd0dabcc09ca1e19562c7bd7de905e82..ae33dfc4ad8178e22c1def3b2656326a34cbfc4a 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 b729e3b24138e96d84fa9bff6c3919142442c217..060f024581a367d8650a183815bbbe96cd8a29f9 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);
@@ -1253,8 +1255,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."));