]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.3-20050714
authorWietse Venema <wietse@porcupine.org>
Thu, 14 Jul 2005 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:31:21 +0000 (06:31 +0000)
171 files changed:
postfix/HISTORY
postfix/html/trivial-rewrite.8.html
postfix/man/man8/trivial-rewrite.8
postfix/src/bounce/bounce_notify_util.c
postfix/src/cleanup/Makefile.in
postfix/src/cleanup/cleanup.h
postfix/src/cleanup/cleanup_envelope.c
postfix/src/cleanup/cleanup_extracted.c
postfix/src/cleanup/cleanup_masquerade.c
postfix/src/cleanup/cleanup_message.c
postfix/src/cleanup/cleanup_out.c
postfix/src/cleanup/cleanup_out_recipient.c
postfix/src/dns/dns.h
postfix/src/dns/dns_lookup.c
postfix/src/dns/dns_rr.c
postfix/src/dns/dns_rr_eq_sa.c
postfix/src/global/anvil_clnt.c
postfix/src/global/bounce_log.c
postfix/src/global/bounce_log.h
postfix/src/global/defer.c
postfix/src/global/dict_proxy.c
postfix/src/global/domain_list.c
postfix/src/global/dsn_util.c
postfix/src/global/ehlo_mask.c
postfix/src/global/header_token.c
postfix/src/global/header_token.h
postfix/src/global/mail_addr_crunch.c
postfix/src/global/mail_addr_find.c
postfix/src/global/mail_addr_map.c
postfix/src/global/mail_conf_raw.c
postfix/src/global/mail_conf_str.c
postfix/src/global/mail_conf_time.c
postfix/src/global/mail_proto.h
postfix/src/global/mail_queue.c
postfix/src/global/mail_queue.h
postfix/src/global/mail_stream.c
postfix/src/global/mail_trigger.c
postfix/src/global/mail_version.h
postfix/src/global/maps.c
postfix/src/global/mbox_open.c
postfix/src/global/mbox_open.h
postfix/src/global/mime_state.c
postfix/src/global/mime_state.h
postfix/src/global/mynetworks.c
postfix/src/global/mypwd.c
postfix/src/global/namadr_list.c
postfix/src/global/off_cvt.c
postfix/src/global/pipe_command.c
postfix/src/global/post_mail.c
postfix/src/global/quote_822_local.c
postfix/src/global/rec2stream.c
postfix/src/global/recdump.c
postfix/src/global/record.c
postfix/src/global/record.h
postfix/src/global/resolve_local.c
postfix/src/global/scache.c
postfix/src/global/smtp_stream.c
postfix/src/global/smtp_stream.h
postfix/src/global/stream2rec.c
postfix/src/global/string_list.c
postfix/src/global/tok822_parse.c
postfix/src/global/verify_clnt.c
postfix/src/global/verp_sender.c
postfix/src/global/xtext.c
postfix/src/lmtp/lmtp_chat.c
postfix/src/local/biff_notify.c
postfix/src/local/biff_notify.h
postfix/src/local/resolve.c
postfix/src/master/mail_flow.c
postfix/src/master/mail_flow.h
postfix/src/oqmgr/qmgr_message.c
postfix/src/postqueue/postqueue.c
postfix/src/qmgr/qmgr_message.c
postfix/src/sendmail/sendmail.c
postfix/src/smtp/smtp_chat.c
postfix/src/smtp/smtp_proto.c
postfix/src/smtp/smtp_unalias.c
postfix/src/smtpd/smtpd.c
postfix/src/smtpd/smtpd_chat.c
postfix/src/smtpd/smtpd_check.c
postfix/src/smtpd/smtpd_proxy.c
postfix/src/smtpd/smtpd_proxy.h
postfix/src/smtpstone/qmqp-source.c
postfix/src/smtpstone/smtp-source.c
postfix/src/tls/tls_dh.c
postfix/src/tls/tls_mgr.c
postfix/src/tls/tls_mgr.h
postfix/src/tls/tls_prng_file.c
postfix/src/tls/tls_scache.c
postfix/src/tls/tls_scache.h
postfix/src/tls/tls_server.c
postfix/src/tls/tls_stream.c
postfix/src/trivial-rewrite/resolve.c
postfix/src/trivial-rewrite/trivial-rewrite.c
postfix/src/util/argv.c
postfix/src/util/argv.h
postfix/src/util/attr_clnt.c
postfix/src/util/attr_print0.c
postfix/src/util/attr_print64.c
postfix/src/util/attr_print_plain.c
postfix/src/util/attr_scan0.c
postfix/src/util/attr_scan64.c
postfix/src/util/attr_scan_plain.c
postfix/src/util/base64_code.c
postfix/src/util/base64_code.h
postfix/src/util/binhash.c
postfix/src/util/clean_env.c
postfix/src/util/concatenate.c
postfix/src/util/dict_cdb.c
postfix/src/util/dict_ni.c
postfix/src/util/dummy_read.c
postfix/src/util/dummy_write.c
postfix/src/util/dup2_pass_on_exec.c
postfix/src/util/environ.c
postfix/src/util/events.c
postfix/src/util/fifo_open.c
postfix/src/util/fifo_rdonly_bug.c
postfix/src/util/fifo_rdwr_bug.c
postfix/src/util/fifo_trigger.c
postfix/src/util/fullname.c
postfix/src/util/hex_code.c
postfix/src/util/hex_code.h
postfix/src/util/hex_quote.c
postfix/src/util/htable.c
postfix/src/util/inet_addr_host.c
postfix/src/util/inet_addr_local.c
postfix/src/util/inet_trigger.c
postfix/src/util/iostuff.h
postfix/src/util/line_wrap.c
postfix/src/util/line_wrap.h
postfix/src/util/mac_expand.c
postfix/src/util/mac_parse.c
postfix/src/util/match_ops.c
postfix/src/util/myaddrinfo.c
postfix/src/util/mymalloc.c
postfix/src/util/mymalloc.h
postfix/src/util/mystrtok.c
postfix/src/util/name_mask.c
postfix/src/util/netstring.c
postfix/src/util/netstring.h
postfix/src/util/open_lock.c
postfix/src/util/open_lock.h
postfix/src/util/peekfd.c
postfix/src/util/readlline.c
postfix/src/util/safe_open.c
postfix/src/util/safe_open.h
postfix/src/util/select_bug.c
postfix/src/util/sigdelay.c
postfix/src/util/spawn_command.c
postfix/src/util/stream_recv_fd.c
postfix/src/util/stream_send_fd.c
postfix/src/util/stream_test.c
postfix/src/util/stream_trigger.c
postfix/src/util/sys_defs.h
postfix/src/util/timed_connect.c
postfix/src/util/timed_read.c
postfix/src/util/timed_write.c
postfix/src/util/trigger.h
postfix/src/util/unescape.c
postfix/src/util/unix_trigger.c
postfix/src/util/vbuf.c
postfix/src/util/vbuf.h
postfix/src/util/vstream.c
postfix/src/util/vstream.h
postfix/src/util/vstream_popen.c
postfix/src/util/vstring.c
postfix/src/util/vstring.h
postfix/src/util/vstring_vstream.c
postfix/src/util/watchdog.c
postfix/src/util/write_buf.c
postfix/src/verify/verify.c

index 3f7eb98515df33c352c1639c81a1514425f3f6bf..8769984417b632d9925cf749744de801f3b8ebf1 100644 (file)
@@ -10980,8 +10980,45 @@ Apologies for any names omitted.
         
 20050708
 
-       Bugfix: missing returns in 20050706 caching disabling code.
-       File: global/scache_clnt.c.
+       Bugfix: missing returns in 20050706 caching disabling code
+       (in error handling code that never executes).  File:
+       global/scache_clnt.c.
+
+       Portability: use explicitly unsigned operands when doing
+       bit-wise shift operations on data larger than a character.
+
+20050709-14
+
+       Migration of data object sizes from int->ssize_t and
+       unsigned->size_t for better portability to LP64 and LLP64
+       systems.  Simply changing everything to size_t would be
+       dangerous. A lot of code was written assuming signed
+       arithmetic; for example, it recognizes negative lengths as
+       an indication of integer overflow.  Files: util/vbuf.[hc],
+       util/mymalloc.[hc], util/vstring.[hc], util/vstream.[hc],
+       util/timed_read.c, util/timed_write.c and functions that
+       override timed_read/write.c; in a later round updated pretty
+       much everything that contains a length of, or an offset
+       into, a buffer. This eliminates unnecessary conversions
+       back and forth between 32-bit and 64-bit integers.
+
+20050710-3
+
+       Portability: on LP64 systems, integer expressions are int,
+       but sizeof() and pointer difference expressions are larger.
+       Fixed a few discrepancies with functions that expect int:
+       util/clean_env.c, util/argv.c, util/attr_print*.c.
+
+20050711
+
+       Bugfix: don't include <> when auto-generating an ORCPT
+       address from a client RCPT TO command. File: smtpd.c.
+
+20050712
+
+       Cleanup: cleanup_out_recipient() still generated DSN records
+       that were incompatible with pre-DSN Postfix versions.  File:
+       cleanup/cleanup_out_recipient.c.
 
 Open problems:
 
index 1ba4a47dea265b92572d5918499ce816ac4761cd..604ab158100f552160d27163b28074e6cf3ae2f8 100644 (file)
@@ -135,8 +135,8 @@ TRIVIAL-REWRITE(8)                                          TRIVIAL-REWRITE(8)
        <b><a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> (empty)</b>
               Don't  rewrite  message headers from remote clients
               at all when this parameter is empty; otherwise, re-
-              write  remote message headers and append the speci-
-              fied domain name to incomplete addresses.
+              write  message  headers  and  append  the specified
+              domain name to incomplete addresses.
 
 <b>ROUTING CONTROLS</b>
        The following is applicable to  Postfix  version  2.0  and
index 97522bca63263228e6ebda43d1c3972765267fe8..40fcfd671d9e939a660a42271f13957ad95a26aa 100644 (file)
@@ -129,8 +129,8 @@ Enable the rewriting of "site!user" into "user@site".
 Available in Postfix 2.2 and later:
 .IP "\fBremote_header_rewrite_domain (empty)\fR"
 Don't rewrite message headers from remote clients at all when
-this parameter is empty; otherwise, rewrite remote message headers
-and append the specified domain name to incomplete addresses.
+this parameter is empty; otherwise, rewrite message headers and
+append the specified domain name to incomplete addresses.
 .SH "ROUTING CONTROLS"
 .na
 .nf
index ae42a3e1869a63c6389a40dbcb0d5fa222e11295..578cc851adf16ead71c2eebc8b55663100e3409f 100644 (file)
@@ -535,11 +535,11 @@ int     bounce_boilerplate(VSTREAM *bounce, BOUNCE_INFO *bounce_info)
 
 /* bounce_print - line_wrap callback */
 
-static void bounce_print(const char *str, int len, int indent, char *context)
+static void bounce_print(const char *str, ssize_t len, ssize_t indent, char *context)
 {
     VSTREAM *bounce = (VSTREAM *) context;
 
-    post_mail_fprintf(bounce, "%*s%.*s", indent, "", len, str);
+    post_mail_fprintf(bounce, "%*s%.*s", (int) indent, "", (int) len, str);
 }
 
 /* bounce_print_wrap - print and wrap a line */
index 51f667270a988c0935745b498bae144956422e0b..9e7b1923fa5983f994bad4f4a6a63c33a861a1d9 100644 (file)
@@ -474,6 +474,7 @@ cleanup_out.o: ../../include/vstring.h
 cleanup_out.o: cleanup.h
 cleanup_out.o: cleanup_out.c
 cleanup_out_recipient.o: ../../include/argv.h
+cleanup_out_recipient.o: ../../include/attr.h
 cleanup_out_recipient.o: ../../include/been_here.h
 cleanup_out_recipient.o: ../../include/bounce.h
 cleanup_out_recipient.o: ../../include/cleanup_user.h
@@ -485,8 +486,10 @@ cleanup_out_recipient.o: ../../include/dsn_mask.h
 cleanup_out_recipient.o: ../../include/ext_prop.h
 cleanup_out_recipient.o: ../../include/header_opts.h
 cleanup_out_recipient.o: ../../include/htable.h
+cleanup_out_recipient.o: ../../include/iostuff.h
 cleanup_out_recipient.o: ../../include/mail_conf.h
 cleanup_out_recipient.o: ../../include/mail_params.h
+cleanup_out_recipient.o: ../../include/mail_proto.h
 cleanup_out_recipient.o: ../../include/mail_queue.h
 cleanup_out_recipient.o: ../../include/mail_stream.h
 cleanup_out_recipient.o: ../../include/maps.h
index 1d9524848685197d5a5f916d022f84ff6753644e..dbd2110a652549429b55f07987134ef8c5a91c11 100644 (file)
@@ -54,10 +54,10 @@ typedef struct CLEANUP_STATE {
     int     hop_count;                 /* count of received: headers */
     char   *resent;                    /* any resent- header seen */
     BH_TABLE *dups;                    /* recipient dup filter */
-    void    (*action) (struct CLEANUP_STATE *, int, const char *, int);
+    void    (*action) (struct CLEANUP_STATE *, int, const char *, ssize_t);
     off_t   data_offset;               /* start of message content */
     off_t   xtra_offset;               /* start of extra segment */
-    int     rcpt_count;                        /* recipient count */
+    ssize_t rcpt_count;                        /* recipient count */
     char   *reason;                    /* failure reason */
     NVTABLE *attr;                     /* queue file attribute list */
     MIME_STATE *mime_state;            /* MIME state engine */
@@ -154,7 +154,7 @@ extern CONFIG_TIME_TABLE cleanup_time_table[];
  /*
   * cleanup_out.c
   */
-extern void cleanup_out(CLEANUP_STATE *, int, const char *, int);
+extern void cleanup_out(CLEANUP_STATE *, int, const char *, ssize_t);
 extern void cleanup_out_string(CLEANUP_STATE *, int, const char *);
 extern void PRINTFLIKE(3, 4) cleanup_out_format(CLEANUP_STATE *, int, const char *,...);
 
@@ -167,17 +167,17 @@ extern void PRINTFLIKE(3, 4) cleanup_out_format(CLEANUP_STATE *, int, const char
  /*
   * cleanup_envelope.c
   */
-extern void cleanup_envelope(CLEANUP_STATE *, int, const char *, int);
+extern void cleanup_envelope(CLEANUP_STATE *, int, const char *, ssize_t);
 
  /*
   * cleanup_message.c
   */
-extern void cleanup_message(CLEANUP_STATE *, int, const char *, int);
+extern void cleanup_message(CLEANUP_STATE *, int, const char *, ssize_t);
 
  /*
   * cleanup_extracted.c
   */
-extern void cleanup_extracted(CLEANUP_STATE *, int, const char *, int);
+extern void cleanup_extracted(CLEANUP_STATE *, int, const char *, ssize_t);
 
  /*
   * cleanup_rewrite.c
index a303830610a19ca763bc8a65435672ab8f9f9093..e2d999705542a416271c61a83dd0a43c5b14d1f0 100644 (file)
@@ -10,7 +10,7 @@
 /*     CLEANUP_STATE *state;
 /*     int     type;
 /*     const char *buf;
-/*     int     len;
+/*     ssize_t len;
 /* DESCRIPTION
 /*     This module processes envelope records and writes the result
 /*     to the queue file.  It validates the message structure, rewrites
 #define STR    vstring_str
 #define STREQ(x,y) (strcmp((x), (y)) == 0)
 
-static void cleanup_envelope_process(CLEANUP_STATE *, int, const char *, int);
+static void cleanup_envelope_process(CLEANUP_STATE *, int, const char *, ssize_t);
 
 /* cleanup_envelope - initialize message envelope */
 
 void    cleanup_envelope(CLEANUP_STATE *state, int type,
-                                const char *str, int len)
+                                const char *str, ssize_t len)
 {
 
     /*
@@ -107,7 +107,7 @@ void    cleanup_envelope(CLEANUP_STATE *state, int type,
 /* cleanup_envelope_process - process one envelope record */
 
 static void cleanup_envelope_process(CLEANUP_STATE *state, int type,
-                                            const char *buf, int len)
+                                            const char *buf, ssize_t len)
 {
     char   *attr_name;
     char   *attr_value;
@@ -118,7 +118,7 @@ static void cleanup_envelope_process(CLEANUP_STATE *state, int type,
     const char *mapped_buf = buf;
 
     if (msg_verbose)
-       msg_info("initial envelope %c %.*s", type, len, buf);
+       msg_info("initial envelope %c %.*s", type, (int) len, buf);
 
     if (type == REC_TYPE_FLGS) {
        /* Not part of queue file format. */
index 7d28d168b486ab99fa324acd5cdc92f37d84eeaf..1e2f43b0617e86dc9690a45c96f55ae7cdd9b0a4 100644 (file)
@@ -10,7 +10,7 @@
 /*     CLEANUP_STATE *state;
 /*     int     type;
 /*     const char *buf;
-/*     int     len;
+/*     ssize_t len;
 /* DESCRIPTION
 /*     This module processes message records with information extracted
 /*     from message content, or with recipients that are stored after the
 
 #define STR(x) vstring_str(x)
 
-static void cleanup_extracted_process(CLEANUP_STATE *, int, const char *, int);
+static void cleanup_extracted_process(CLEANUP_STATE *, int, const char *, ssize_t);
 static void cleanup_extracted_finish(CLEANUP_STATE *);
 
 /* cleanup_extracted - initialize extracted segment */
 
 void    cleanup_extracted(CLEANUP_STATE *state, int type,
-                                 const char *buf, int len)
+                                 const char *buf, ssize_t len)
 {
 
     /*
@@ -96,7 +96,7 @@ void    cleanup_extracted(CLEANUP_STATE *state, int type,
 /* cleanup_extracted_process - process one extracted envelope record */
 
 void    cleanup_extracted_process(CLEANUP_STATE *state, int type,
-                                         const char *buf, int len)
+                                         const char *buf, ssize_t len)
 {
     const char *encoding;
     const char generated_by_cleanup[] = {
@@ -109,7 +109,7 @@ void    cleanup_extracted_process(CLEANUP_STATE *state, int type,
     int     junk;
 
     if (msg_verbose)
-       msg_info("extracted envelope %c %.*s", type, len, buf);
+       msg_info("extracted envelope %c %.*s", type, (int) len, buf);
 
     if (strchr(REC_TYPE_EXTRACT, type) == 0) {
        msg_warn("%s: message rejected: "
index f54fb7e5a28da47de6cbd6e1a023e69b20506c02..0a4fededb39efe6eb8fecefde9788be314bec668 100644 (file)
 int     cleanup_masquerade_external(VSTRING *addr, ARGV *masq_domains)
 {
     char   *domain;
-    int     domain_len;
+    ssize_t domain_len;
     char  **masqp;
     char   *masq;
-    int     masq_len;
+    ssize_t masq_len;
     char   *parent;
     int     truncate;
     int     did_rewrite = 0;
index 127870f0fe053fec1c9988c490fe9df5b93ebd5f..81ab2e145a8d675f067b9a7b3ffa1e16ff5d1193 100644 (file)
@@ -10,7 +10,7 @@
 /*     CLEANUP_STATE *state;
 /*     int     type;
 /*     const char *buf;
-/*     int     len;
+/*     ssize_t len;
 /* DESCRIPTION
 /*     This module processes message content records and copies the
 /*     result to the queue file.  It validates the input, rewrites
@@ -663,7 +663,7 @@ static void cleanup_header_done_callback(void *context)
 /* cleanup_body_callback - output one body record */
 
 static void cleanup_body_callback(void *context, int type,
-                                         const char *buf, int len,
+                                         const char *buf, ssize_t len,
                                          off_t offset)
 {
     CLEANUP_STATE *state = (CLEANUP_STATE *) context;
@@ -699,7 +699,7 @@ static void cleanup_body_callback(void *context, int type,
 /* cleanup_message_headerbody - process message content, header and body */
 
 static void cleanup_message_headerbody(CLEANUP_STATE *state, int type,
-                                              const char *buf, int len)
+                                              const char *buf, ssize_t len)
 {
     char   *myname = "cleanup_message_headerbody";
     MIME_STATE_DETAIL *detail;
@@ -763,7 +763,7 @@ static void cleanup_mime_error_callback(void *context, int err_code,
 
 /* cleanup_message - initialize message content segment */
 
-void    cleanup_message(CLEANUP_STATE *state, int type, const char *buf, int len)
+void    cleanup_message(CLEANUP_STATE *state, int type, const char *buf, ssize_t len)
 {
     char   *myname = "cleanup_message";
     int     mime_options;
index 959038386d7beba7ee6d7587159bb5c28aa8b2fe..f72d941295b7322162cb0bba26cd4c8ecf0060e7 100644 (file)
@@ -13,7 +13,7 @@
 /*     CLEANUP_STATE *state;
 /*     int     type;
 /*     const char *data;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     void    cleanup_out_string(state, type, str)
 /*     CLEANUP_STATE *state;
@@ -85,7 +85,7 @@
 
 /* cleanup_out - output one single record */
 
-void    cleanup_out(CLEANUP_STATE *state, int type, const char *string, int len)
+void    cleanup_out(CLEANUP_STATE *state, int type, const char *string, ssize_t len)
 {
     int     err = 0;
 
index 4bdadc3dc0c440fae1f7a3f4b2dce57e050b03f6..ad3d04b61d707db8546d70f19748051df452d48e 100644 (file)
@@ -81,6 +81,7 @@
 #include <dsn.h>
 #include <trace.h>
 #include <mail_queue.h>                        /* cleanup_trace_path */
+#include <mail_proto.h>
 
 /* Application-specific. */
 
@@ -134,10 +135,11 @@ void    cleanup_out_recipient(CLEANUP_STATE *state,
        if (been_here(state->dups, "%s\n%d\n%s\n%s",
                      dsn_orcpt, dsn_notify, orcpt, recip) == 0) {
            if (dsn_notify)
-               cleanup_out_format(state, REC_TYPE_DSN_NOTIFY, "%d",
-                                  dsn_notify);
+               cleanup_out_format(state, REC_TYPE_ATTR, "%s=%d",
+                                  MAIL_ATTR_DSN_NOTIFY, dsn_notify);
            if (*dsn_orcpt)
-               cleanup_out_string(state, REC_TYPE_DSN_ORCPT, dsn_orcpt);
+               cleanup_out_format(state, REC_TYPE_ATTR, "%s=%s",
+                                  MAIL_ATTR_DSN_ORCPT, dsn_orcpt);
            cleanup_out_string(state, REC_TYPE_ORCP, orcpt);
            cleanup_out_string(state, REC_TYPE_RCPT, recip);
            state->rcpt_count++;
@@ -199,10 +201,11 @@ void    cleanup_out_recipient(CLEANUP_STATE *state,
            if (been_here(state->dups, "%s\n%d\n%s\n%s",
                          dsn_orcpt, dsn_notify, orcpt, *cpp) == 0) {
                if (dsn_notify)
-                   cleanup_out_format(state, REC_TYPE_DSN_NOTIFY, "%d",
-                                      dsn_notify);
+                   cleanup_out_format(state, REC_TYPE_ATTR, "%s=%d",
+                                      MAIL_ATTR_DSN_NOTIFY, dsn_notify);
                if (*dsn_orcpt)
-                   cleanup_out_string(state, REC_TYPE_DSN_ORCPT, dsn_orcpt);
+                   cleanup_out_format(state, REC_TYPE_ATTR, "%s=%s",
+                                      MAIL_ATTR_DSN_ORCPT, dsn_orcpt);
                cleanup_out_string(state, REC_TYPE_ORCP, orcpt);
                cleanup_out_string(state, REC_TYPE_RCPT, *cpp);
                state->rcpt_count++;
index 90a45b82c7c3dfb7995200b3b2a00e33a700877e..a54d9a808feab44997a27bb3909dc04b5e6e77a2 100644 (file)
@@ -83,7 +83,7 @@ typedef struct DNS_RR {
     unsigned int ttl;                  /* always */
     unsigned short pref;               /* T_MX only */
     struct DNS_RR *next;               /* linkage */
-    unsigned data_len;                 /* actual data size */
+    size_t data_len;                   /* actual data size */
     char    data[1];                   /* actually a bunch of data */
 } DNS_RR;
 
@@ -103,7 +103,7 @@ extern unsigned dns_type(const char *);
   */
 extern DNS_RR *dns_rr_create(const char *, ushort, ushort,
                                     unsigned, unsigned,
-                                    const char *, unsigned);
+                                    const char *, size_t);
 extern void dns_rr_free(DNS_RR *);
 extern DNS_RR *dns_rr_copy(DNS_RR *);
 extern DNS_RR *dns_rr_append(DNS_RR *, DNS_RR *);
index 6bb49f0aadf46098cdf27dd9c22a5aa4d5f27e3d..187da911edbfa3ee5c3e25e9a59389bf1ba31f42 100644 (file)
@@ -344,7 +344,7 @@ static DNS_RR *dns_get_rr(DNS_REPLY *reply, unsigned char *pos,
                                  char *rr_name, DNS_FIXED *fixed)
 {
     char    temp[DNS_NAME_LEN];
-    int     data_len;
+    ssize_t data_len;
     unsigned pref = 0;
     unsigned char *src;
     unsigned char *dst;
index fe6a2306722b7e42603f09336f98363cf72dd8fb..01732d0ddaa297f61aa6ca89c49252c63fc8a5e2 100644 (file)
@@ -14,7 +14,7 @@
 /*     unsigned int ttl;
 /*     unsigned preference;
 /*     const char *data;
-/*     unsigned len;
+/*     size_t data_len;
 /*
 /*     void    dns_rr_free(list)
 /*     DNS_RR  *list;
@@ -93,7 +93,7 @@
 
 DNS_RR *dns_rr_create(const char *name, ushort type, ushort class,
                              unsigned int ttl, unsigned pref,
-                             const char *data, unsigned data_len)
+                             const char *data, size_t data_len)
 {
     DNS_RR *rr;
 
@@ -126,7 +126,7 @@ void    dns_rr_free(DNS_RR *rr)
 
 DNS_RR *dns_rr_copy(DNS_RR *src)
 {
-    int     len = sizeof(*src) + src->data_len - 1;
+    ssize_t len = sizeof(*src) + src->data_len - 1;
     DNS_RR *dst;
 
     /*
index 27495fca683093bd81c70fd046ed630d04cc0a05..baecab7908f34579a0d83922e9e88841246d1bc3 100644 (file)
@@ -132,6 +132,7 @@ int     main(int argc, char **argv)
        vstream_fflush(VSTREAM_OUT);
        argv += 1;
     }
+    return (0);
 }
 
 #endif
index 7b4ea84b62f6ab0034615089ffbba4ba5157e8cf..c54b9500b9caaa8111752a089d28ac1a535437cf 100644 (file)
@@ -337,7 +337,7 @@ int main(int unused_argc, char **argv)
     VSTRING *inbuf = vstring_alloc(1);
     char   *bufp;
     char   *cmd;
-    int            cmd_len;
+    ssize_t cmd_len;
     char   *service;
     char   *addr;
     int            count;
index f28b1a70ccdb49c3bbbfb1ba414accb5486d8bf4..0fac7f986b0260a396fd39df641c5a6863094890 100644 (file)
@@ -18,7 +18,7 @@
 /*     const char *queue;
 /*     const char *id;
 /*     int     flags;
-/*     int     mode;
+/*     mode_t  mode;
 /*
 /*     BOUNCE_LOG *bounce_log_read(bp)
 /*     BOUNCE_LOG *bp;
@@ -73,7 +73,7 @@
 /*     file has the same name as the original message file.
 /* .IP flags
 /*     File open flags, as with open(2).
-/* .IP more
+/* .IP mode
 /*     File permissions, as with open(2).
 /* .PP
 /*     Recipient results:
 /* bounce_log_open - open bounce read stream */
 
 BOUNCE_LOG *bounce_log_open(const char *queue_name, const char *queue_id,
-                                   int flags, int mode)
+                                   int flags, mode_t mode)
 {
     BOUNCE_LOG *bp;
     VSTREAM *fp;
index 67eea4159913a0a355204b6d3d6c321560c622f5..235772ed306fcd1d03a16e1568235b1c78073f85 100644 (file)
@@ -41,7 +41,7 @@ typedef struct {
     DSN     dsn;                       /* delivery status */
 } BOUNCE_LOG;
 
-extern BOUNCE_LOG *bounce_log_open(const char *, const char *, int, int);
+extern BOUNCE_LOG *bounce_log_open(const char *, const char *, int, mode_t);
 extern BOUNCE_LOG *bounce_log_read(BOUNCE_LOG *);
 extern BOUNCE_LOG *bounce_log_delrcpt(BOUNCE_LOG *);
 extern BOUNCE_LOG *bounce_log_forge(RECIPIENT *, DSN *);
index f11ba02429b349b7d428783aa924a7cf982b20ce..32a304c1660dd5cc110719cb38515cbf0f062ffc 100644 (file)
@@ -257,7 +257,7 @@ int     defer_flush(int flags, const char *queue, const char *id,
  * do not flush the log */
 
 int     defer_warn(int flags, const char *queue, const char *id,
-                          const char *sender, const char *envid, int ret)
+                        const char *sender, const char *envid, int dsn_ret)
 {
     if (mail_command_client(MAIL_CLASS_PRIVATE, var_defer_service,
                            ATTR_TYPE_NUM, MAIL_ATTR_NREQ, BOUNCE_CMD_WARN,
@@ -266,7 +266,7 @@ int     defer_warn(int flags, const char *queue, const char *id,
                            ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
                            ATTR_TYPE_STR, MAIL_ATTR_SENDER, sender,
                            ATTR_TYPE_STR, MAIL_ATTR_DSN_ENVID, envid,
-                           ATTR_TYPE_NUM, MAIL_ATTR_DSN_RET, ret,
+                           ATTR_TYPE_NUM, MAIL_ATTR_DSN_RET, dsn_ret,
                            ATTR_TYPE_END) == 0) {
        return (0);
     } else {
index 81aae3462049810ca63199042bdc512bab9d0486..f4eea08bde579cd40821b43449e6fc30ce5ef0a9 100644 (file)
@@ -8,7 +8,7 @@
 /*
 /*     DICT    *dict_proxy_open(map, open_flags, dict_flags)
 /*     const char *map;
-/*     int     dummy;
+/*     int     open_flags;
 /*     int     dict_flags;
 /* DESCRIPTION
 /*     dict_proxy_open() relays read-only operations through
index a2e7d95ff668a5844736ed8ef60d0f3d76efe8d0..b5617a7aaf239877ab2b14e1a543943cf6beae7b 100644 (file)
@@ -116,6 +116,7 @@ int     main(int argc, char **argv)
                   "YES" : "NO");
     vstream_fflush(VSTREAM_OUT);
     domain_list_free(list);
+    return (0);
 }
 
 #endif
index 8d4b2ef009d711e5f35a85c9c54a9bcaefcabd3f..a4d7ceed5898acb5281d6d6dc9a6a0a60eba9faa 100644 (file)
 size_t  dsn_valid(const char *text)
 {
     const unsigned char *cp = (unsigned char *) text;
-    int     len;
+    size_t  len;
 
     /* First portion is one digit followed by dot. */
     if ((cp[0] != '2' && cp[0] != '4' && cp[0] != '5') || cp[1] != '.')
index d711731c45cd01872cc4ce78671c0bdc9498abc8..811005487749c0696dafc3937ec9c7b626b7cf2b 100644 (file)
@@ -110,6 +110,7 @@ const char *str_ehlo_mask(int mask_bits)
  /*
   * Stand-alone test program.
   */
+#include <stdlib.h>
 #include <vstream.h>
 #include <vstring.h>
 #include <vstring_vstream.h>
index 20bbc486eb7827a47063b0d01787031b32d9e94d..3375125749188f1c1dceecbea045434ae7d43e6b 100644 (file)
 /* .in
 /*     } HEADER_TOKEN;
 /*
-/*     int     header_token(token, token_len, token_buffer, ptr,
+/*     ssize_t header_token(token, token_len, token_buffer, ptr,
 /*                             specials, terminator)
 /*     HEADER_TOKEN *token;
-/*     int     token_len;
+/*     ssize_t token_len;
 /*     VSTRING *token_buffer;
 /*     const char **ptr;
 /*     const char *specials;
 
 /* header_token - parse out the next item in a message header */
 
-int     header_token(HEADER_TOKEN *token, int token_len,
+ssize_t header_token(HEADER_TOKEN *token, ssize_t token_len,
                             VSTRING *token_buffer, const char **ptr,
                             const char *user_specials, int user_terminator)
 {
-    int     comment_level;
+    ssize_t comment_level;
     const unsigned char *cp;
-    int     len;
+    ssize_t len;
     int     ch;
-    int     tok_count;
-    int     n;
+    ssize_t tok_count;
+    ssize_t n;
 
     /*
      * Initialize.
index 222d3d79f1d9feff1f5f9e6117ae48754f39fab8..7154ef7e565227757023ca9fecfe6d653f3be0a7 100644 (file)
@@ -24,14 +24,14 @@ typedef struct HEADER_TOKEN {
     int     type;                      /* see below */
     union {
        const char *value;              /* just a pointer, not a copy */
-       int     offset;                 /* index into token buffer */
+       ssize_t offset;                 /* index into token buffer */
     }       u;                         /* indent beats any alternative */
 } HEADER_TOKEN;
 
 #define HEADER_TOK_TOKEN       256
 #define HEADER_TOK_QSTRING     257
 
-extern int header_token(HEADER_TOKEN *, int, VSTRING *, const char **, const char *, int);
+extern ssize_t header_token(HEADER_TOKEN *, ssize_t, VSTRING *, const char **, const char *, int);
 
 /* LICENSE
 /* .ad
index cd1bda9b110c3b120d4920d6b23e25b1c1fe66fd..8f92d29683dd74a24c3be02d4ef74ea147d04d75 100644 (file)
@@ -66,7 +66,7 @@ ARGV   *mail_addr_crunch(const char *string, const char *extension)
     TOK822 **addr_list;
     TOK822 **tpp;
     char   *ratsign;
-    int     extlen;
+    ssize_t extlen;
 
     if (extension)
        extlen = strlen(extension);
@@ -113,6 +113,7 @@ ARGV   *mail_addr_crunch(const char *string, const char *extension)
  /*
   * Stand-alone test program, sort of interactive.
   */
+#include <stdlib.h>
 #include <unistd.h>
 #include <msg.h>
 #include <vstream.h>
@@ -144,6 +145,7 @@ int     main(int unused_argc, char **unused_argv)
            vstream_printf("    %s\n", *cpp);
        vstream_fflush(VSTREAM_OUT);
     }
+    return (0);
 }
 
 #endif
index c08f9dbcf79ddad44ee342bd3eb187fa6c25fcb6..cda022b043e4e3c99eb0f4eed60f33f89a4024f6 100644 (file)
@@ -213,6 +213,7 @@ int     main(int argc, char **argv)
     vstring_free(buffer);
 
     maps_free(path);
+    return (0);
 }
 
 #endif
index df6237ec68b1e620b014fbd1ba98bfeba7949594..ad0c6c39423856acd94459ed74d2a36bc47d76b3 100644 (file)
@@ -191,6 +191,7 @@ int     main(int argc, char **argv)
     }
     vstring_free(buffer);
     maps_free(path);
+    return (0);
 }
 
 #endif
index 4c7927d5ab07d7a8c6d0341e7fd0a73bd8c9f6cd..2e4c9832ef153c7e7fa167b43878c04caf0450d9 100644 (file)
 static void check_mail_conf_raw(const char *name, const char *strval,
                                     int min, int max)
 {
-    int     len = strlen(strval);
+    ssize_t len = strlen(strval);
 
     if (min && len < min)
-       msg_fatal("bad string length (%d < %d): %s = %s",
-                 len, min, name, strval);
+       msg_fatal("bad string length (%ld < %d): %s = %s",
+                 (long) len, min, name, strval);
     if (max && len > max)
-       msg_fatal("bad string length (%d > %d): %s = %s",
-                 len, max, name, strval);
+       msg_fatal("bad string length (%ld > %d): %s = %s",
+                 (long) len, max, name, strval);
 }
 
 /* get_mail_conf_raw - evaluate string-valued configuration variable */
index 1c2c170ab80b99a1f47d20c9aaa78013b9638797..bb734520d15ac98cd69deb956f736433f7023e29 100644 (file)
 static void check_mail_conf_str(const char *name, const char *strval,
                                     int min, int max)
 {
-    int     len = strlen(strval);
+    ssize_t len = strlen(strval);
 
     if (min && len < min)
-       msg_fatal("bad string length %d < %d: %s = %s",
-                 len, min, name, strval);
+       msg_fatal("bad string length %ld < %d: %s = %s",
+                 (long) len, min, name, strval);
     if (max && len > max)
-       msg_fatal("bad string length %d > %d: %s = %s",
-                 len, max, name, strval);
+       msg_fatal("bad string length %ld > %d: %s = %s",
+                 (long) len, max, name, strval);
 }
 
 /* get_mail_conf_str - evaluate string-valued configuration variable */
index 682a6863d89aec5406384eec03279b2d17138726..e7c4f0c5a4a08317b310985f5590b8309e8518f6 100644 (file)
@@ -237,6 +237,7 @@ int     main(int unused_argc, char **unused_argv)
     vstream_printf("10 days = %d\n", days);
     vstream_printf("10 weeks = %d\n", weeks);
     vstream_fflush(VSTREAM_OUT);
+    return (0);
 }
 
 #endif
index a170596c023cccdc2fd1b760bf5bf5e80f48eba6..53ca483a813ba3631987c0579042b9e29e54f866 100644 (file)
@@ -84,7 +84,7 @@ extern VSTREAM *mail_connect(const char *, const char *, int);
 extern VSTREAM *mail_connect_wait(const char *, const char *);
 extern int mail_command_client(const char *, const char *,...);
 extern int mail_command_server(VSTREAM *,...);
-extern int mail_trigger(const char *, const char *, const char *, int);
+extern int mail_trigger(const char *, const char *, const char *, ssize_t);
 extern char *mail_pathname(const char *, const char *);
 
  /*
index 9068955c32921c13a46408e89d330ecf81e0f848..1b9f316118e2eda0f48922188c752a855dcf2c70 100644 (file)
@@ -8,13 +8,13 @@
 /*
 /*     VSTREAM *mail_queue_enter(queue_name, mode)
 /*     const char *queue_name;
-/*     int     mode;
+/*     mode_t  mode;
 /*
 /*     VSTREAM *mail_queue_open(queue_name, queue_id, flags, mode)
 /*     const char *queue_name;
 /*     const char *queue_id;
 /*     int     flags;
-/*     int     mode;
+/*     mode_t  mode;
 /*
 /*     char    *mail_queue_dir(buf, queue_name, queue_id)
 /*     VSTRING *buf;
@@ -304,7 +304,7 @@ int     mail_queue_id_ok(const char *queue_id)
 
 /* mail_queue_enter - make mail queue entry with locally-unique name */
 
-VSTREAM *mail_queue_enter(const char *queue_name, int mode)
+VSTREAM *mail_queue_enter(const char *queue_name, mode_t mode)
 {
     char   *myname = "mail_queue_enter";
     static VSTRING *id_buf;
@@ -407,7 +407,7 @@ VSTREAM *mail_queue_enter(const char *queue_name, int mode)
 /* mail_queue_open - open mail queue file */
 
 VSTREAM *mail_queue_open(const char *queue_name, const char *queue_id,
-                                int flags, int mode)
+                                int flags, mode_t mode)
 {
     const char *path = mail_queue_path((VSTRING *) 0, queue_name, queue_id);
     VSTREAM *fp;
index b3d692821d440b3d3a13744d08f7f2b9f749ba74..19c04b7b8a0587a7081764f2043ab0b6f33dc276 100644 (file)
@@ -37,8 +37,8 @@
 #define MAIL_QUEUE_STAT_READY  (S_IRUSR | S_IWUSR | S_IXUSR)
 #define MAIL_QUEUE_STAT_CORRUPT        (S_IRUSR)
 
-extern struct VSTREAM *mail_queue_enter(const char *, int);
-extern struct VSTREAM *mail_queue_open(const char *, const char *, int, int);
+extern struct VSTREAM *mail_queue_enter(const char *, mode_t);
+extern struct VSTREAM *mail_queue_open(const char *, const char *, int, mode_t);
 extern int mail_queue_rename(const char *, const char *, const char *);
 extern int mail_queue_remove(const char *, const char *);
 extern const char *mail_queue_dir(VSTRING *, const char *, const char *);
index 86d1da83fcd1d1a881e3e901e55305075984ae15..5ac392b1a1be10768359ace98a451275303097f2 100644 (file)
@@ -88,7 +88,8 @@
 /* .IP "MAIL_STREAM_CTL_SERVICE (char *)"
 /*     The argument specifies an alternate trigger service.
 /* .IP "MAIL_STREAM_CTL_MODE (int)"
-/*     The argument specifies an altername file mode.
+/*     The argument specifies alternate permissions that override
+/*     the permissions specified with mail_stream_file().
 /* LICENSE
 /* .ad
 /* .fi
index 457f19d6b8fd4a0cf0485d5c37290a5a287d1799..5f9ac580ae58c90f04553e5c95f58ddd881470c0 100644 (file)
@@ -10,7 +10,7 @@
 /*     const char *class;
 /*     const char *service;
 /*     const char *request;
-/*     int     length;
+/*     ssize_t length;
 /* DESCRIPTION
 /*     mail_trigger() wakes up the specified mail subsystem, by
 /*     sending it the specified request.
@@ -67,7 +67,7 @@
 /* mail_trigger - trigger a service */
 
 int     mail_trigger(const char *class, const char *service,
-                            const char *req_buf, int req_len)
+                            const char *req_buf, ssize_t req_len)
 {
     struct stat st;
     char   *path;
index 87fbef89df70710aff82efd80fbbdf59a533345f..fba46100cdbd2ba3629cc33644c4bf3a48bd353c 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change both the patchlevel and the release date. Snapshots have no
   * patchlevel; they change the release date only.
   */
-#define MAIL_RELEASE_DATE      "20050708"
+#define MAIL_RELEASE_DATE      "20050714"
 #define MAIL_VERSION_NUMBER    "2.3"
 
 #define VAR_MAIL_VERSION       "mail_version"
index 8df0107061fc0d750f4ee24b025371f1dec50d8d..ad97ee6d61be9185c55516562ad7c5d9139a8ad8 100644 (file)
@@ -239,6 +239,7 @@ int     main(int argc, char **argv)
     }
     maps_free(maps);
     vstring_free(buf);
+    return (0);
 }
 
 #endif
index 7c6751058bacbe4d8b040e5381f119630b15d365..de3d1551eb2794f38626fbdfbd8a71b2c4595413 100644 (file)
@@ -17,7 +17,7 @@
 /*                             def_dsn, why)
 /*     const char *path;
 /*     int     flags;
-/*     int     mode;
+/*     mode_t  mode;
 /*     struct stat *st;
 /*     uid_t   user;
 /*     gid_t   group;
 
 /* mbox_open - open mailbox-style file for exclusive access */
 
-MBOX   *mbox_open(const char *path, int flags, int mode, struct stat * st,
+MBOX   *mbox_open(const char *path, int flags, mode_t mode, struct stat * st,
                          uid_t chown_uid, gid_t chown_gid,
                          int lock_style, const char *def_dsn,
                          DSN_BUF *why)
index 843c377090ca8a6167f75e460431ba01d322701c..54d13c6594a15af3c06a714c246c8ef1b84a33dc 100644 (file)
@@ -31,7 +31,7 @@ typedef struct {
     VSTREAM *fp;                       /* open stream or null */
     int     locked;                    /* what locks were set */
 } MBOX;
-extern MBOX *mbox_open(const char *, int, int, struct stat *, uid_t, gid_t,
+extern MBOX *mbox_open(const char *, int, mode_t, struct stat *, uid_t, gid_t,
                               int, const char *, DSN_BUF *);
 extern void mbox_release(MBOX *);
 extern const char *mbox_dsn(int, const char *);
index 409e1231d66d3e289fe338bfa3ad3e90d6899558..31c166508435f5478f89e5bc1869ff5e2181f4b8 100644 (file)
@@ -7,15 +7,15 @@
 /*     #include <mime_state.h>
 /*
 /*     MIME_STATE *mime_state_alloc(flags, head_out, head_end,
-/*                                  body_out, body_end,
-/*                                  err_print, context)
+/*                                      body_out, body_end,
+/*                                      err_print, context)
 /*     int     flags;
 /*     void    (*head_out)(void *ptr, int header_class,
 /*                             HEADER_OPTS *header_info,
 /*                             VSTRING *buf, off_t offset);
 /*     void    (*head_end)(void *ptr);
 /*     void    (*body_out)(void *ptr, int rec_type,
-/*                             const char *buf, int len,
+/*                             const char *buf, ssize_t len,
 /*                             off_t offset);
 /*     void    (*body_end)(void *ptr);
 /*     void    (*err_print)(void *ptr, int err_flag, const char *text)
@@ -25,7 +25,7 @@
 /*     MIME_STATE *state;
 /*     int     rec_type;
 /*     const char *buf;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     MIME_STATE *mime_state_free(state)
 /*     MIME_STATE *state;
@@ -269,7 +269,7 @@ typedef struct MIME_STACK {
     int     def_ctype;                 /* default content type */
     int     def_stype;                 /* default content subtype */
     char   *boundary;                  /* boundary string */
-    int     bound_len;                 /* boundary length */
+    ssize_t bound_len;                 /* boundary length */
     struct MIME_STACK *next;           /* linkage */
 } MIME_STACK;
 
@@ -516,7 +516,7 @@ static void mime_state_content_type(MIME_STATE *state,
                                            HEADER_OPTS *header_info)
 {
     const char *cp;
-    int     tok_count;
+    ssize_t tok_count;
     int     def_ctype;
     int     def_stype;
 
@@ -665,7 +665,7 @@ static const char *mime_state_enc_name(int encoding)
 /* mime_state_downgrade - convert 8-bit data to quoted-printable */
 
 static void mime_state_downgrade(MIME_STATE *state, int rec_type,
-                                        const char *text, int len)
+                                        const char *text, ssize_t len)
 {
     static char hexchars[] = "0123456789ABCDEF";
     const unsigned char *cp;
@@ -723,7 +723,7 @@ static void mime_state_downgrade(MIME_STATE *state, int rec_type,
 /* mime_state_update - update MIME state machine */
 
 int     mime_state_update(MIME_STATE *state, int rec_type,
-                                 const char *text, int len)
+                                 const char *text, ssize_t len)
 {
     int     input_is_text = (rec_type == REC_TYPE_NORM
                             || rec_type == REC_TYPE_CONT);
@@ -1108,7 +1108,7 @@ static void head_end(void *context)
     vstream_fprintf(stream, "HEADER END\n");
 }
 
-static void body_out(void *context, int rec_type, const char *buf, int len,
+static void body_out(void *context, int rec_type, const char *buf, ssize_t len,
                             off_t offset)
 {
     VSTREAM *stream = (VSTREAM *) context;
index 820be42885231301019aa0d20bcabe6e923b4119..952967b1180f502187f70397e17c4a93dc11e005 100644 (file)
   */
 typedef struct MIME_STATE MIME_STATE;
 typedef void (*MIME_STATE_HEAD_OUT) (void *, int, HEADER_OPTS *, VSTRING *, off_t);
-typedef void (*MIME_STATE_BODY_OUT) (void *, int, const char *, int, off_t);
+typedef void (*MIME_STATE_BODY_OUT) (void *, int, const char *, ssize_t, off_t);
 typedef void (*MIME_STATE_ANY_END) (void *);
 typedef void (*MIME_STATE_ERR_PRINT) (void *, int, const char *);
 
 extern MIME_STATE *mime_state_alloc(int, MIME_STATE_HEAD_OUT, MIME_STATE_ANY_END, MIME_STATE_BODY_OUT, MIME_STATE_ANY_END, MIME_STATE_ERR_PRINT, void *);
-extern int mime_state_update(MIME_STATE *, int, const char *, int);
+extern int mime_state_update(MIME_STATE *, int, const char *, ssize_t);
 extern MIME_STATE *mime_state_free(MIME_STATE *);
 
  /*
index d698be7fc80a75084ee51350a8490d83b08a80c6..9a910a032043cd336e116188ff3f07165fde6bd2 100644 (file)
@@ -90,10 +90,10 @@ const char *mynetworks(void)
        char   *myname = "mynetworks";
        INET_ADDR_LIST *my_addr_list;
        INET_ADDR_LIST *my_mask_list;
-       int     shift;
-       int     junk;
+       unsigned shift;
+       unsigned junk;
        int     i;
-       int     mask_style;
+       unsigned mask_style;
        struct sockaddr_storage *sa;
        struct sockaddr_storage *ma;
        int     net_mask_count = 0;
@@ -109,7 +109,7 @@ const char *mynetworks(void)
         * require exactly one value, or we need to provide an API that is
         * dedicated for single-valued flags.
         */
-       for (i = 0, junk = mask_style; junk != 0; junk >>= 1)
+       for (i = 0, junk = mask_style; junk != 0; junk >>= 1U)
            i += (junk & 1);
        if (i != 1)
            msg_fatal("bad %s value: %s; specify exactly one value",
@@ -293,6 +293,7 @@ int     main(int argc, char **argv)
     var_mynetworks_style = argv[2];
     var_inet_interfaces = argv[3];
     mynetworks();
+    return (0);
 }
 
 #endif
index 23fb29589f02be1a4201057ec67d03077bb2a5dd..2b7821382c1316df88d3cabcc876ed220dd849d8 100644 (file)
@@ -228,6 +228,7 @@ int     main(int argc, char **argv)
     }
 
     myfree((char *) mypwd);
+    return (0);
 }
 
 #endif
index 3388023b3172c666ead7fc8da595187996f916e3..f74b8337a6f1b84cec0ad002c6ee04bd648b6dd5 100644 (file)
@@ -125,6 +125,7 @@ int     main(int argc, char **argv)
                   "YES" : "NO");
     vstream_fflush(VSTREAM_OUT);
     namadr_list_free(list);
+    return (0);
 }
 
 #endif
index 756b63c8c6082ff6b7d71c90bca68d49a00945e1..d560516811eb3e78ca4eece59d040c3bf9947262 100644 (file)
@@ -152,6 +152,7 @@ int     main(int unused_argc, char **unused_argv)
        vstream_fflush(VSTREAM_OUT);
     }
     vstring_free(buf);
+    return (0);
 }
 
 #endif
index ebdcd6ef0cb7cbc7fb5c5369e9a6021519590411..d3319ec306eb909ca1ec9bcc6f38d0007fe5536e 100644 (file)
 /*     \fImail_copy\fR() routine.
 /* .IP "PIPE_CMD_EOL (char *)"
 /*     End-of-line delimiter. The default is to use the newline character.
-/* .IP "PIPE_CMD_UID (int)"
+/* .IP "PIPE_CMD_UID (uid_t)"
 /*     The user ID to execute the command as. The default is
 /*     the user ID corresponding to the \fIdefault_privs\fR
 /*     configuration parameter. The user ID must be non-zero.
-/* .IP "PIPE_CMD_GID (int)"
+/* .IP "PIPE_CMD_GID (gid_t)"
 /*     The group ID to execute the command as. The default is
 /*     the group ID corresponding to the \fIdefault_privs\fR
 /*     configuration parameter. The group ID must be non-zero.
@@ -234,10 +234,10 @@ static void get_pipe_args(struct pipe_args * args, va_list ap)
            args->command = va_arg(ap, char *);
            break;
        case PIPE_CMD_UID:
-           args->uid = va_arg(ap, int);        /* in case uid_t is short */
+           args->uid = va_arg(ap, uid_t);      /* in case uid_t is short */
            break;
        case PIPE_CMD_GID:
-           args->gid = va_arg(ap, int);        /* in case gid_t is short */
+           args->gid = va_arg(ap, gid_t);      /* in case gid_t is short */
            break;
        case PIPE_CMD_TIME_LIMIT:
            pipe_command_maxtime = va_arg(ap, int);
@@ -268,7 +268,7 @@ static void get_pipe_args(struct pipe_args * args, va_list ap)
 
 /* pipe_command_write - write to command with time limit */
 
-static int pipe_command_write(int fd, void *buf, unsigned len)
+static ssize_t pipe_command_write(int fd, void *buf, ssize_t len)
 {
     int     maxtime = (pipe_command_timeout == 0) ? pipe_command_maxtime : 0;
     char   *myname = "pipe_command_write";
@@ -289,7 +289,7 @@ static int pipe_command_write(int fd, void *buf, unsigned len)
 
 /* pipe_command_read - read from command with time limit */
 
-static int pipe_command_read(int fd, void *buf, unsigned len)
+static ssize_t pipe_command_read(int fd, void *buf, ssize_t len)
 {
     int     maxtime = (pipe_command_timeout == 0) ? pipe_command_maxtime : 0;
     char   *myname = "pipe_command_read";
@@ -574,7 +574,7 @@ int     pipe_command(VSTREAM *src, DSN_BUF *why,...)
            else if (dsn_valid(log_buf) > 0) {
                dsn_split(&dp, "5.3.0", log_buf);
                dsb_unix(why, DSN_STATUS(dp.dsn), DSN_CLASS(dp.dsn) == '4' ?
-                        EX_TEMPFAIL : EX_UNAVAILABLE, dp.text, "%s", dp.text);
+                     EX_TEMPFAIL : EX_UNAVAILABLE, dp.text, "%s", dp.text);
                return (DSN_CLASS(dp.dsn) == '4' ?
                        PIPE_STAT_DEFER : PIPE_STAT_BOUNCE);
            }
index b79967dd1929c5927262cb47067d32c4268ce6d4..93850d9344cf89866e0698e7453d3690171a4586 100644 (file)
@@ -383,7 +383,7 @@ int     post_mail_buffer(VSTREAM *cleanup, const char *buf, int len)
 
 int     post_mail_fputs(VSTREAM *cleanup, const char *str)
 {
-    int     len = str ? strlen(str) : 0;
+    ssize_t len = str ? strlen(str) : 0;
 
     return (rec_put(cleanup, REC_TYPE_NORM, str, len) != REC_TYPE_NORM ?
            CLEANUP_STAT_WRITE : 0);
index bf18059d3be9ba53995706fda02fcd6c920833e7..a16149d2bccd8f9d1cb475c9bd5e69dc73f64dbf 100644 (file)
@@ -235,6 +235,7 @@ int     main(int unused_argc, char **unused_argv)
     vstring_free(unquoted);
     vstring_free(quoted);
     vstring_free(raw);
+    return (0);
 }
 
 #endif
index 8188f1f6e431309ea3680e8fcd75884f0f765cd1..4b72c42e2bfd405e02216dcd76780307d923506e 100644 (file)
@@ -43,4 +43,5 @@ int     main(void)
     while ((type = rec_get(VSTREAM_IN, buf, 0)) > 0)
        REC_STREAMLF_PUT_BUF(VSTREAM_OUT, type, buf);
     vstream_fflush(VSTREAM_OUT);
+    return (0);
 }
index 74ff7ea02e0270cb028ee5adbb216b971e0ad389..aa13eb644c54a1c69a7390c07d52e00cc9621439 100644 (file)
@@ -24,6 +24,7 @@
 /* System library. */
 
 #include <sys_defs.h>
+#include <stdlib.h>
 
 /* Utility library. */
 
@@ -46,9 +47,9 @@ int     main(int unused_argc, char **argv)
     while (offset = vstream_ftell(VSTREAM_IN),
           ((type = rec_get(VSTREAM_IN, buf, 0)) != REC_TYPE_EOF
           && type != REC_TYPE_ERROR)) {
-       vstream_fprintf(VSTREAM_OUT, "%15s|%4ld|%3d|%s\n",
+       vstream_fprintf(VSTREAM_OUT, "%15s|%4ld|%3ld|%s\n",
                        rec_type_name(type), offset,
-                       VSTRING_LEN(buf), vstring_str(buf));
+                       (long) VSTRING_LEN(buf), vstring_str(buf));
     }
     vstream_fflush(VSTREAM_OUT);
     vstring_free(buf);
index 5e91a9ee5489bb4a60a227dcbaee5ef74b0388ed..2e63278efc11c891d114eeed5aef28038a9f4d0e 100644 (file)
@@ -9,13 +9,13 @@
 /*     int     rec_get(stream, buf, maxsize)
 /*     VSTREAM *stream;
 /*     VSTRING *buf;
-/*     int     maxsize;
+/*     ssize_t maxsize;
 /*
 /*     int     rec_put(stream, type, data, len)
 /*     VSTREAM *stream;
 /*     int     type;
 /*     const char *data;
-/*     int     len;
+/*     ssize_t len;
 /* AUXILIARY FUNCTIONS
 /*     int     rec_put_type(stream, type, offset)
 /*     VSTREAM *stream;
@@ -129,16 +129,17 @@ int     rec_put_type(VSTREAM *stream, int type, long offset)
 
 /* rec_put - store typed record */
 
-int     rec_put(VSTREAM *stream, int type, const char *data, int len)
+int     rec_put(VSTREAM *stream, int type, const char *data, ssize_t len)
 {
-    int     len_rest;
-    int     len_byte;
+    ssize_t len_rest;
+    ssize_t len_byte;
 
     if (type < 0 || type > 255)
        msg_panic("rec_put: bad record type %d", type);
 
     if (msg_verbose > 2)
-       msg_info("rec_put: type %c len %d data %.10s", type, len, data);
+       msg_info("rec_put: type %c len %ld data %.10s",
+                type, (long) len, data);
 
     /*
      * Write the record type, one byte.
@@ -153,7 +154,7 @@ int     rec_put(VSTREAM *stream, int type, const char *data, int len)
     len_rest = len;
     do {
        len_byte = len_rest & 0177;
-       if (len_rest >>= 7)
+       if (len_rest >>= 7U)
            len_byte |= 0200;
        if (VSTREAM_PUTC(len_byte, stream) == VSTREAM_EOF) {
            return (REC_TYPE_ERROR);
@@ -170,19 +171,19 @@ int     rec_put(VSTREAM *stream, int type, const char *data, int len)
 
 /* rec_get - retrieve typed record */
 
-int     rec_get(VSTREAM *stream, VSTRING *buf, int maxsize)
+int     rec_get(VSTREAM *stream, VSTRING *buf, ssize_t maxsize)
 {
     char   *myname = "rec_get";
     int     type;
-    int     len;
+    ssize_t len;
     int     len_byte;
-    int     shift;
+    unsigned shift;
 
     /*
      * Sanity check.
      */
     if (maxsize < 0)
-       msg_panic("%s: bad record size limit: %d", myname, maxsize);
+       msg_panic("%s: bad record size limit: %ld", myname, (long) maxsize);
 
     /*
      * Extract the record type.
@@ -211,8 +212,8 @@ int     rec_get(VSTREAM *stream, VSTRING *buf, int maxsize)
            break;
     }
     if (len < 0 || (maxsize > 0 && len > maxsize)) {
-       msg_warn("%s: illegal length %d, record type %d",
-                VSTREAM_PATH(stream), len, type);
+       msg_warn("%s: illegal length %ld, record type %d",
+                VSTREAM_PATH(stream), (long) len, type);
        while (len-- > 0 && VSTREAM_GETC(stream) != VSTREAM_EOF)
             /* void */ ;
        return (REC_TYPE_ERROR);
@@ -225,15 +226,15 @@ int     rec_get(VSTREAM *stream, VSTRING *buf, int maxsize)
     VSTRING_RESET(buf);
     VSTRING_SPACE(buf, len);
     if (vstream_fread(stream, vstring_str(buf), len) != len) {
-       msg_warn("%s: unexpected EOF in data, record type %d length %d",
-                VSTREAM_PATH(stream), type, len);
+       msg_warn("%s: unexpected EOF in data, record type %d length %ld",
+                VSTREAM_PATH(stream), type, (long) len);
        return (REC_TYPE_ERROR);
     }
     VSTRING_AT_OFFSET(buf, len);
     VSTRING_TERMINATE(buf);
     if (msg_verbose > 2)
-       msg_info("%s: type %c len %d data %.10s", myname,
-                type, len, vstring_str(buf));
+       msg_info("%s: type %c len %ld data %.10s", myname,
+                type, (unsigned long) len, vstring_str(buf));
     return (type);
 }
 
index da91dc3e10ddd0244e9fc734ba638f0443cb21ac..32e724cfb9aa277d120047fcdfda35c8c4926d9b 100644 (file)
@@ -32,8 +32,8 @@
  /*
   * Functional interface.
   */
-extern int rec_get(VSTREAM *, VSTRING *, int);
-extern int rec_put(VSTREAM *, int, const char *, int);
+extern int rec_get(VSTREAM *, VSTRING *, ssize_t);
+extern int rec_put(VSTREAM *, int, const char *, ssize_t);
 extern int rec_put_type(VSTREAM *, int, long);
 extern int PRINTFLIKE(3, 4) rec_fprintf(VSTREAM *, int, const char *,...);
 extern int rec_fputs(VSTREAM *, int, const char *);
index 830ad54c2bc7c7a72ebf15c08f89fea7477ab025..fdbf7c528468222b63d0d6ae1098247b346894fc 100644 (file)
@@ -76,7 +76,7 @@ int     resolve_local(const char *addr)
     char   *dest;
     const char *bare_dest;
     struct addrinfo *res0 = 0;
-    int     len;
+    ssize_t len;
 
 #define RETURN(x) \
     do { \
@@ -170,6 +170,7 @@ int     main(int argc, char **argv)
     mail_conf_read();
     vstream_printf("%s\n", resolve_local(argv[1]) ? "yes" : "no");
     vstream_fflush(VSTREAM_OUT);
+    return (0);
 }
 
 #endif
index 61347047bb336df7b5d9513d675aeb7358391c40..2a242ae0e4dffdc06c7d2091c483b63f41fccd7b 100644 (file)
 #include <sys_defs.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <string.h>
 
 /* Utility library. */
 
index ba4b78e7c640116e1ecca75e310a6cb272c44b7b..dbaf48c6c9700e4792fee2051867419c1a034487 100644 (file)
 /*     int     smtp_get(vp, stream, maxlen)
 /*     VSTRING *vp;
 /*     VSTREAM *stream;
-/*     int     maxlen;
+/*     ssize_t maxlen;
 /*
 /*     void    smtp_fputs(str, len, stream)
 /*     const char *str;
-/*     int     len;
+/*     ssize_t len;
 /*     VSTREAM *stream;
 /*
 /*     void    smtp_fwrite(str, len, stream)
 /*     const char *str;
-/*     int     len;
+/*     ssize_t len;
 /*     VSTREAM *stream;
 /*
 /*     void    smtp_fputc(ch, stream)
@@ -247,7 +247,7 @@ int     smtp_fgetc(VSTREAM *stream)
 
 /* smtp_get - read one line from SMTP peer */
 
-int     smtp_get(VSTRING *vp, VSTREAM *stream, int bound)
+int     smtp_get(VSTRING *vp, VSTREAM *stream, ssize_t bound)
 {
     int     last_char;
     int     next_char;
@@ -317,12 +317,12 @@ int     smtp_get(VSTRING *vp, VSTREAM *stream, int bound)
 
 /* smtp_fputs - write one line to SMTP peer */
 
-void    smtp_fputs(const char *cp, int todo, VSTREAM *stream)
+void    smtp_fputs(const char *cp, ssize_t todo, VSTREAM *stream)
 {
-    unsigned err;
+    size_t  err;
 
     if (todo < 0)
-       msg_panic("smtp_fputs: negative todo %d", todo);
+       msg_panic("smtp_fputs: negative todo %ld", (long) todo);
 
     /*
      * Do the I/O, protected against timeout.
@@ -344,12 +344,12 @@ void    smtp_fputs(const char *cp, int todo, VSTREAM *stream)
 
 /* smtp_fwrite - write one string to SMTP peer */
 
-void    smtp_fwrite(const char *cp, int todo, VSTREAM *stream)
+void    smtp_fwrite(const char *cp, ssize_t todo, VSTREAM *stream)
 {
-    unsigned err;
+    size_t  err;
 
     if (todo < 0)
-       msg_panic("smtp_fwrite: negative todo %d", todo);
+       msg_panic("smtp_fwrite: negative todo %ld", (long) todo);
 
     /*
      * Do the I/O, protected against timeout.
index cbd0f7aba0e81b638962f751322fc2e522fbed8a..2fc2f5f66c981afd8b0548f0cfadbcc7d52693bc 100644 (file)
@@ -33,9 +33,9 @@ extern void smtp_timeout_setup(VSTREAM *, int);
 extern void PRINTFLIKE(2, 3) smtp_printf(VSTREAM *, const char *,...);
 extern void smtp_flush(VSTREAM *);
 extern int smtp_fgetc(VSTREAM *);
-extern int smtp_get(VSTRING *, VSTREAM *, int);
-extern void smtp_fputs(const char *, int len, VSTREAM *);
-extern void smtp_fwrite(const char *, int len, VSTREAM *);
+extern int smtp_get(VSTRING *, VSTREAM *, ssize_t);
+extern void smtp_fputs(const char *, ssize_t len, VSTREAM *);
+extern void smtp_fwrite(const char *, ssize_t len, VSTREAM *);
 extern void smtp_fputc(int, VSTREAM *);
 
 extern void smtp_vprintf(VSTREAM *, const char *, va_list);
index a7da5c5eaab6a5b8dde897f62f5416fa3c9cd928..1dbd9622993f47a358d7f42ddfdf3ad9b663b542 100644 (file)
@@ -43,4 +43,5 @@ int     main(void)
     while ((type = rec_streamlf_get(VSTREAM_IN, buf, 150)) > 0)
        REC_PUT_BUF(VSTREAM_OUT, type, buf);
     vstream_fflush(VSTREAM_OUT);
+    return (0);
 }
index bed30deabf54ff169b5abb307195e169b29734c0..42cbec00956f6674853b5e5f956b7fe0e275c068 100644 (file)
@@ -105,6 +105,7 @@ int     main(int argc, char **argv)
                   "YES" : "NO");
     vstream_fflush(VSTREAM_OUT);
     string_list_free(list);
+    return (0);
 }
 
 #endif
index c337ccb8f7c593c7f316ddcc8d3ffdc95e1a60a9..63f998c956dd66c69ec22728d099e84a5e0a0b6f 100644 (file)
@@ -243,7 +243,7 @@ VSTRING *tok822_internalize(VSTRING *vp, TOK822 *tree, int flags)
 
 /* strip_address - strip non-address text from address expression */
 
-static void strip_address(VSTRING *vp, int start, TOK822 *addr)
+static void strip_address(VSTRING *vp, ssize_t start, TOK822 *addr)
 {
     VSTRING *tmp;
 
@@ -270,9 +270,9 @@ VSTRING *tok822_externalize(VSTRING *vp, TOK822 *tree, int flags)
 {
     VSTRING *tmp;
     TOK822 *tp;
-    int     start;
+    ssize_t start;
     TOK822 *addr;
-    int     addr_len;
+    ssize_t addr_len;
 
     /*
      * Guard against a Sendmail buffer overflow (CERT advisory CA-2003-07).
index 5c45ea62194d9bb5fc09ad7feee04b31adee7200..14dd3cd5e0ae70ad24af78ddfd5361eba44f0993 100644 (file)
@@ -284,6 +284,7 @@ int     main(int argc, char **argv)
            msg_warn("unrecognized command: %s", command);
     }
     vstring_free(buffer);
+    return (0);
 }
 
 #endif
index b7c0f806e06dced2b2e59d1e727ad0c404c40613..bed3b3d8c9253ee217d70a165975b6332c410599 100644 (file)
@@ -66,8 +66,8 @@
 VSTRING *verp_sender(VSTRING *buf, const char *delimiters,
                             const char *sender, const char *recipient)
 {
-    int     send_local_len;
-    int     rcpt_local_len;
+    ssize_t send_local_len;
+    ssize_t rcpt_local_len;
     const char *cp;
 
     /*
index c711cafda3fda2165cdb3d06415e730220de110f..a736070f56265cfb0b637452ec9084c59a1a2c15 100644 (file)
@@ -132,9 +132,9 @@ VSTRING *xtext_unquote(VSTRING *unquoted, const char *quoted)
 
 #define BUFLEN 1024
 
-static int read_buf(VSTREAM *fp, VSTRING *buf)
+static ssize_t read_buf(VSTREAM *fp, VSTRING *buf)
 {
-    int     len;
+    ssize_t len;
 
     VSTRING_RESET(buf);
     len = vstream_fread(fp, STR(buf), vstring_avail(buf));
@@ -147,14 +147,15 @@ int     main(int unused_argc, char **unused_argv)
 {
     VSTRING *unquoted = vstring_alloc(BUFLEN);
     VSTRING *quoted = vstring_alloc(100);
-    int     len;
+    ssize_t len;
 
     while ((len = read_buf(VSTREAM_IN, unquoted)) > 0) {
        xtext_quote(quoted, STR(unquoted), "+=");
        if (xtext_unquote(unquoted, STR(quoted)) == 0)
            msg_fatal("bad input: %.100s", STR(quoted));
        if (LEN(unquoted) != len)
-           msg_fatal("len %d != unquoted len %d", len, LEN(unquoted));
+           msg_fatal("len %ld != unquoted len %ld",
+                     (long) len, (long) LEN(unquoted));
        if (vstream_fwrite(VSTREAM_OUT, STR(unquoted), LEN(unquoted)) != LEN(unquoted))
            msg_fatal("write error: %m");
     }
index 608b8a8f3ebc24cac062acd6d3c83c92ccd2e93d..e99107c2a8114005a8f5c8df14687495d85c1b5a 100644 (file)
@@ -286,11 +286,11 @@ LMTP_RESP *lmtp_chat_resp(LMTP_STATE *state)
 
 /* print_line - line_wrap callback */
 
-static void print_line(const char *str, int len, int indent, char *context)
+static void print_line(const char *str, ssize_t len, ssize_t indent, char *context)
 {
     VSTREAM *notice = (VSTREAM *) context;
 
-    post_mail_fprintf(notice, " %*s%.*s", indent, "", len, str);
+    post_mail_fprintf(notice, " %*s%.*s", (int) indent, "", (int) len, str);
 }
 
 /* lmtp_chat_notify - notify postmaster */
index 2b02508d3a3c5433c4eb2452e185af2461fcbf5f..b189ad4b2d4a7302971ed279971b7ec3538644d2 100644 (file)
@@ -8,7 +8,7 @@
 /*
 /*     void    biff_notify(text, len)
 /*     const char *text;
-/*     int     len;
+/*     ssize_t len;
 /* DESCRIPTION
 /*     biff_notify() sends a \fBBIFF\fR notification request to the
 /*     \fBcomsat\fR daemon.
@@ -50,7 +50,7 @@
 
 /* biff_notify - notify recipient via the biff "protocol" */
 
-void    biff_notify(const char *text, int len)
+void    biff_notify(const char *text, ssize_t len)
 {
     static struct sockaddr_in sin;
     static int sock = -1;
index b2b8548f9a526398bad65fa72c02bb639f5d647b..8b76f9dc6d2910d95742659cc873d1e322320c81 100644 (file)
@@ -14,7 +14,7 @@
  /*
   * External interface.
   */
-extern void biff_notify(const char *, int);
+extern void biff_notify(const char *, ssize_t);
 
 /* LICENSE
 /* .ad
index 3f0a0f3b9f986fe88928605aadbb1c39e90f2528..2a2f6833706768980c1a4a817798dc764a1c08ea 100644 (file)
@@ -88,7 +88,7 @@ int     deliver_resolve_tree(LOCAL_STATE state, USER_ATTR usr_attr, TOK822 *addr
     char   *myname = "deliver_resolve_tree";
     RESOLVE_REPLY reply;
     int     status;
-    int     ext_len;
+    ssize_t ext_len;
     char   *ratsign;
 
     /*
index 383ba5816c5a9e454d1765c0d1b812e6c934e9ee..b0cd7c1028c9e2ec11adbb8ae51c84cd6097ee80 100644 (file)
@@ -6,13 +6,13 @@
 /* SYNOPSIS
 /*     #include <mail_flow.h>
 /*
-/*     int     mail_flow_get(count)
-/*     int     count;
+/*     ssize_t mail_flow_get(count)
+/*     ssize_t count;
 /*
-/*     void    mail_flow_put(count)
-/*     int     count;
+/*     ssize_t mail_flow_put(count)
+/*     ssize_t count;
 /*
-/*     int     mail_flow_count()
+/*     ssize_t mail_flow_count()
 /* DESCRIPTION
 /*     This module implements a simple flow control mechanism that
 /*     is based on tokens that are consumed by mail receiving processes
 
 /* mail_flow_get - read N tokens */
 
-int     mail_flow_get(int len)
+ssize_t mail_flow_get(ssize_t len)
 {
     char   *myname = "mail_flow_get";
     char    buf[BUFFER_SIZE];
     struct stat st;
-    int     count;
-    int     n = 0;
+    ssize_t count;
+    ssize_t n = 0;
 
     /*
      * Sanity check.
      */
     if (len <= 0)
-       msg_panic("%s: bad length %d", myname, len);
+       msg_panic("%s: bad length %ld", myname, (long) len);
 
     /*
      * Silence some wild claims.
@@ -95,24 +95,24 @@ int     mail_flow_get(int len)
                      BUFFER_SIZE : count)) <= 0)
            return (-1);
     if (msg_verbose)
-       msg_info("%s: %d %d", myname, len, len - count);
+       msg_info("%s: %ld %ld", myname, (long) len, (long) (len - count));
     return (len - count);
 }
 
 /* mail_flow_put - put N tokens */
 
-int     mail_flow_put(int len)
+ssize_t mail_flow_put(ssize_t len)
 {
     char   *myname = "mail_flow_put";
     char    buf[BUFFER_SIZE];
-    int     count;
-    int     n = 0;
+    ssize_t count;
+    ssize_t n = 0;
 
     /*
      * Sanity check.
      */
     if (len <= 0)
-       msg_panic("%s: bad length %d", myname, len);
+       msg_panic("%s: bad length %ld", myname, (long) len);
 
     /*
      * Write or discard N bytes.
@@ -124,16 +124,16 @@ int     mail_flow_put(int len)
                       BUFFER_SIZE : count)) < 0)
            return (-1);
     if (msg_verbose)
-       msg_info("%s: %d %d", myname, len, len - count);
+       msg_info("%s: %ld %ld", myname, (long) len, (long) (len - count));
     return (len - count);
 }
 
 /* mail_flow_count - return number of available tokens */
 
-int     mail_flow_count(void)
+ssize_t mail_flow_count(void)
 {
     char   *myname = "mail_flow_count";
-    int     count;
+    ssize_t count;
 
     if ((count = peekfd(MASTER_FLOW_READ)) < 0)
        msg_warn("%s: %m", myname);
index 9e058598f5d2e6c363075d8b8ded42ae128f1fe9..3f7f7bd3025f6e70559b283be358bba54ac9363d 100644 (file)
@@ -14,9 +14,9 @@
  /*
   * Functional interface.
   */
-extern int mail_flow_get(int);
-extern int mail_flow_put(int);
-extern int mail_flow_count(void);
+extern ssize_t mail_flow_get(ssize_t);
+extern ssize_t mail_flow_put(ssize_t);
+extern ssize_t mail_flow_count(void);
 
 /* LICENSE
 /* .ad
index b13798fbc80fec8cd27cb6f2ee9bad89518348ed..6df21567968a1df08fbe358adeb6585ca55d100c 100644 (file)
@@ -880,7 +880,7 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message)
     char   *at;
     char  **cpp;
     char   *nexthop;
-    int     len;
+    ssize_t len;
     int     status;
     DSN     dsn;
 
index dce53cfe3eb9c6f2af19e0d210291c3aaefef442..76925d55e72d45f7daddb94cf0f27a502228daf7 100644 (file)
@@ -381,7 +381,6 @@ int     main(int argc, char **argv)
     int     mode = PQ_MODE_DEFAULT;
     char   *site_to_flush = 0;
     ARGV   *import_env;
-    char   *last;
     int     bad_site;
 
     /*
index e3ff32f0b1883b92b16cdd9d0b628e5f79e2a0b7..e1868d6802306edc4952e06ba9c1e8805a263ea8 100644 (file)
@@ -922,7 +922,7 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message)
     char   *at;
     char  **cpp;
     char   *nexthop;
-    int     len;
+    ssize_t len;
     int     status;
     DSN     dsn;
 
index ba4470351afb033edffb2524960e881018c72d62..955137de60c071de38d4762e4943b09431728b61 100644 (file)
@@ -480,7 +480,7 @@ static CONFIG_STR_TABLE str_table[] = {
 
 /* output_text - output partial or complete text line */
 
-static void output_text(void *context, int rec_type, const char *buf, int len,
+static void output_text(void *context, int rec_type, const char *buf, ssize_t len,
                                off_t unused_offset)
 {
     SM_STATE *state = (SM_STATE *) context;
@@ -505,7 +505,7 @@ static void output_header(void *context, int header_class,
     char   *start;
     char   *line;
     char   *next_line;
-    int     len;
+    ssize_t len;
 
     /*
      * Parse the header line, and save copies of recipient addresses in the
index 7f27fc20f60251bedc25db5312f4d3b46c4a6f98..4e9b6f3eb384c891b97830428a213467206e6ec3 100644 (file)
@@ -306,11 +306,11 @@ SMTP_RESP *smtp_chat_resp(SMTP_SESSION *session)
 
 /* print_line - line_wrap callback */
 
-static void print_line(const char *str, int len, int indent, char *context)
+static void print_line(const char *str, ssize_t len, ssize_t indent, char *context)
 {
     VSTREAM *notice = (VSTREAM *) context;
 
-    post_mail_fprintf(notice, " %*s%.*s", indent, "", len, str);
+    post_mail_fprintf(notice, " %*s%.*s", (int) indent, "", (int) len, str);
 }
 
 /* smtp_chat_notify - notify postmaster */
index 856c4c10c8b3cecda1a06d6cfae91984c900bf72..b9da58558ca8c7bce2840e22dc8b7d80c581aad1 100644 (file)
@@ -647,12 +647,12 @@ static int smtp_start_tls(SMTP_STATE *state, int misc_flags)
 /* smtp_text_out - output one header/body record */
 
 static void smtp_text_out(void *context, int rec_type,
-                                 const char *text, int len,
+                                 const char *text, ssize_t len,
                                  off_t unused_offset)
 {
     SMTP_STATE *state = (SMTP_STATE *) context;
     SMTP_SESSION *session = state->session;
-    int     data_left;
+    ssize_t data_left;
     const char *data_start;
 
     /*
index 395fd695f0f88913f73903b0699efb72f32f4544..4e9a81acebaa3010c4ca23de9ce40dbdf2b7bdeb 100644 (file)
@@ -136,6 +136,7 @@ int     main(int unused_argc, char **unused_argv)
     }
     vstring_free(addr);
     vstring_free(result);
+    return (0);
 }
 
 #endif
index 772509932ebb3dbb96553b3fc92a393b351a24c2..7be9340df01c50e8d54abcabbc46b7e23abc93ad 100644 (file)
@@ -1759,6 +1759,7 @@ static int rcpt_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv)
     char   *arg;
     int     rate;
     const char *dsn_orcpt_addr = 0;
+    ssize_t dsn_orcpt_addr_len = 0;
     const char *dsn_orcpt_type = 0;
     int     dsn_notify = 0;
     const char *coded_addr;
@@ -1846,6 +1847,7 @@ static int rcpt_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv)
                return (-1);
            }
            dsn_orcpt_addr = STR(state->dsn_buf);
+           dsn_orcpt_addr_len = LEN(state->dsn_buf);
        } else {
            state->error_mask |= MAIL_ERROR_PROTOCOL;
            smtpd_chat_reply(state, "555 5.5.4 Unsupported option: %s", arg);
@@ -1955,12 +1957,19 @@ static int rcpt_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv)
        if (dsn_orcpt_addr == 0) {
            dsn_orcpt_type = "rfc822";
            dsn_orcpt_addr = argv[2].strval;
+           dsn_orcpt_addr_len = strlen(argv[2].strval);
+           if (dsn_orcpt_addr[0] == '<'
+               && dsn_orcpt_addr[dsn_orcpt_addr_len - 1] == '>') {
+               dsn_orcpt_addr += 1;
+               dsn_orcpt_addr_len -= 2;
+           }
        }
        if (dsn_notify)
            rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%d",
                        MAIL_ATTR_DSN_NOTIFY, dsn_notify);
-       rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s;%s",
-                   MAIL_ATTR_DSN_ORCPT, dsn_orcpt_type, dsn_orcpt_addr);
+       rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s;%.*s",
+                   MAIL_ATTR_DSN_ORCPT, dsn_orcpt_type,
+                   (int) dsn_orcpt_addr_len, dsn_orcpt_addr);
        rec_fputs(state->cleanup, REC_TYPE_RCPT, STR(state->addr_buf));
        vstream_fflush(state->cleanup);
     }
@@ -2025,7 +2034,7 @@ static int data_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *unused_argv)
     int     first = 1;
     VSTRING *why = 0;
     int     saved_err;
-    int     (*out_record) (VSTREAM *, int, const char *, int);
+    int     (*out_record) (VSTREAM *, int, const char *, ssize_t);
     int     (*out_fprintf) (VSTREAM *, int, const char *,...);
     VSTREAM *out_stream;
     int     out_error;
@@ -2973,10 +2982,10 @@ static void smtpd_start_tls(SMTPD_STATE *state)
      * verification unless TLS is required.
      */
     state->tls_context =
-       tls_server_start(smtpd_tls_ctx, state->client,
-                        var_smtpd_starttls_tmout,
-                        state->name, state->addr, &(state->tls_info),
-                      (var_smtpd_tls_req_ccert && state->tls_enforce_tls));
+    tls_server_start(smtpd_tls_ctx, state->client,
+                    var_smtpd_starttls_tmout,
+                    state->name, state->addr, &(state->tls_info),
+                    (var_smtpd_tls_req_ccert && state->tls_enforce_tls));
 
     /*
      * When the TLS handshake fails, the conversation is in an unknown state.
@@ -3505,7 +3514,7 @@ static void post_jail_init(char *unused_name, char **unused_argv)
      * recipient checks, address mapping, header_body_checks?.
      */
     smtpd_input_transp_mask =
-       input_transp_mask(VAR_INPUT_TRANSP, var_input_transp);
+    input_transp_mask(VAR_INPUT_TRANSP, var_input_transp);
 
     /*
      * Sanity checks. The queue_minfree value should be at least as large as
index 2962b1efbe43f07de9966596faa6d4510c7f4386..394e52b16d6c3f4ecce363eb119295bcc298090e 100644 (file)
@@ -183,11 +183,11 @@ void    smtpd_chat_reply(SMTPD_STATE *state, char *format,...)
 
 /* print_line - line_wrap callback */
 
-static void print_line(const char *str, int len, int indent, char *context)
+static void print_line(const char *str, ssize_t len, ssize_t indent, char *context)
 {
     VSTREAM *notice = (VSTREAM *) context;
 
-    post_mail_fprintf(notice, " %*s%.*s", indent, "", len, str);
+    post_mail_fprintf(notice, " %*s%.*s", (int) indent, "", (int) len, str);
 }
 
 /* smtpd_chat_notify - notify postmaster */
index 9389da1903235611b2f6b98e2b53acd171677d39..a56c4cb76d00c3c0e0761cf83ca2d6fe33112f20 100644 (file)
@@ -965,7 +965,7 @@ static int permit_mynetworks(SMTPD_STATE *state)
 
 static char *dup_if_truncate(char *name)
 {
-    int     len;
+    ssize_t len;
     char   *result;
 
     /*
@@ -990,7 +990,7 @@ static int reject_invalid_hostaddr(SMTPD_STATE *state, char *addr,
                                        char *reply_name, char *reply_class)
 {
     char   *myname = "reject_invalid_hostaddr";
-    int     len;
+    ssize_t len;
     char   *test_addr;
     int     stat;
 
@@ -2337,7 +2337,7 @@ static int check_server_access(SMTPD_STATE *state, const char *table,
     if (*domain == '[') {
        char   *saved_addr;
        const char *bare_addr;
-       int     len;
+       ssize_t len;
 
        if (type != T_MX)
            return (SMTPD_CHECK_DUNNO);
index b5ff2df22100f1bc963615c8d4a4ca11011b1ea2..35ebcf61f8ddc2fb4426f9d2d3a76cec82473edd 100644 (file)
@@ -35,7 +35,7 @@
 /*     VSTREAM *stream;
 /*     int     rec_type;
 /*     const char *data;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     int     smtpd_proxy_rec_fprintf(stream, rec_type, format, ...)
 /*     VSTREAM *stream;
@@ -538,7 +538,7 @@ int     smtpd_proxy_cmd(SMTPD_STATE *state, int expect, const char *fmt,...)
 /* smtpd_proxy_rec_put - send message content, rec_put() clone */
 
 int     smtpd_proxy_rec_put(VSTREAM *stream, int rec_type,
-                                   const char *data, int len)
+                                   const char *data, ssize_t len)
 {
     int     err;
 
index e91543117229d8d38024172092301421813935da..11f59ff97c9735a36671a968c5901ecaf624f75b 100644 (file)
@@ -25,7 +25,7 @@
 
 extern int smtpd_proxy_open(SMTPD_STATE *, const char *, int, const char *, const char *);
 extern int PRINTFLIKE(3, 4) smtpd_proxy_cmd(SMTPD_STATE *, int, const char *,...);
-extern int smtpd_proxy_rec_put(VSTREAM *, int, const char *, int);
+extern int smtpd_proxy_rec_put(VSTREAM *, int, const char *, ssize_t);
 extern int PRINTFLIKE(3, 4) smtpd_proxy_rec_fprintf(VSTREAM *, int, const char *,...);
 extern void smtpd_proxy_close(SMTPD_STATE *);
 
index 367de51bd93259b6a180d3d3efbfeda1cac54b3f..ec0c457d6074297ef06e5119c9d670276a5d3c7a 100644 (file)
@@ -372,7 +372,7 @@ static void send_data(SESSION *session)
                        STR(message_buffer), LEN(message_buffer),
                        STR(sender_buffer), LEN(sender_buffer),
                        STR(recipient_buffer), LEN(recipient_buffer),
-                       0);
+                       (ssize_t) 0);
     netstring_fflush(session->stream);
 
     /*
@@ -442,6 +442,7 @@ int     main(int argc, char **argv)
     int     path_len;
     int     sessions = 1;
     int     ch;
+    ssize_t len;
     int     n;
     int     i;
     char   *buf;
@@ -587,14 +588,14 @@ int     main(int argc, char **argv)
     STR(buffer)[message_length - 1] = '\n';
     netstring_memcpy(message_buffer, STR(buffer), message_length);
 
-    n = strlen(sender);
-    sender_buffer = vstring_alloc(n);
-    netstring_memcpy(sender_buffer, sender, n);
+    len = strlen(sender);
+    sender_buffer = vstring_alloc(len);
+    netstring_memcpy(sender_buffer, sender, len);
 
     if (recipients == 1) {
-       n = strlen(recipient);
-       recipient_buffer = vstring_alloc(n);
-       netstring_memcpy(recipient_buffer, recipient, n);
+       len = strlen(recipient);
+       recipient_buffer = vstring_alloc(len);
+       netstring_memcpy(recipient_buffer, recipient, len);
     } else {
        recipient_buffer = vstring_alloc(100);
        for (n = 0; n < recipients; n++) {
index 99f389e344983c949f9e53f9ef64aab65acdc849..ed796a74a6179454cb2c343ee0f9ef031442fcfe 100644 (file)
@@ -277,7 +277,7 @@ static RESPONSE *response(VSTREAM *stream, VSTRING *buf)
      */
     if (rdata.buf == 0) {
        rdata.buf = vstring_alloc(100);
-       vstring_ctl(rdata.buf, VSTRING_CTL_MAXLEN, var_line_limit, 0);
+       vstring_ctl(rdata.buf, VSTRING_CTL_MAXLEN, (ssize_t) var_line_limit, 0);
     }
 
     /*
@@ -938,7 +938,7 @@ int     main(int argc, char **argv)
      */
     if (buffer == 0) {
        buffer = vstring_alloc(100);
-       vstring_ctl(buffer, VSTRING_CTL_MAXLEN, var_line_limit, 0);
+       vstring_ctl(buffer, VSTRING_CTL_MAXLEN, (ssize_t) var_line_limit, 0);
     }
 
     /*
index 5752333034a59a3e2765856ef24ad66b6683b7f0..a4e99268cb989780d7f5431d3b5612e6de997952 100644 (file)
@@ -226,6 +226,7 @@ int main(int unused_argc, char **unused_argv)
     tls_tmp_dh_cb(0, 1, 1024);
     tls_tmp_dh_cb(0, 1, 2048);
     tls_tmp_dh_cb(0, 0, 512);
+    return (0);
 }
 
 #endif
index 61f45f820aa21b53788d751893e7bce8d3af9a4b..22b9acdba78de2ed281c195031f70ffcf93b688c 100644 (file)
@@ -17,7 +17,7 @@
 /*     int     cache_type;
 /*     const char *cache_id;
 /*     const char *buf;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     int     tls_mgr_lookup(cache_type, cache_id, buf)
 /*     int     cache_type;
@@ -229,7 +229,7 @@ int     tls_mgr_lookup(int cache_type, const char *cache_id, VSTRING *buf)
 /* tls_mgr_update - save session to cache */
 
 int     tls_mgr_update(int cache_type, const char *cache_id,
-                              const char *buf, int len)
+                              const char *buf, ssize_t len)
 {
     int     status;
 
@@ -377,6 +377,7 @@ int     main(int unused_ac, char **av)
        argv_free(argv);
 
     vstring_free(inbuf);
+    return (0);
 }
 
 #endif                                 /* TEST */
index 92aa5f50d1199d7d6e0747771b51716070ef8e3b..068002c3a8bc34c6a5fddf84ca90c71c456af868 100644 (file)
@@ -50,7 +50,7 @@
 extern int tls_mgr_seed(VSTRING *, int);
 extern int tls_mgr_policy(int *);
 extern int tls_mgr_lookup(int, const char *, VSTRING *);
-extern int tls_mgr_update(int, const char *, const char *, int);
+extern int tls_mgr_update(int, const char *, const char *, ssize_t);
 extern int tls_mgr_delete(int, const char *);
 
 /* LICENSE
index 83754e4b7b75d99fa9fc05d1ca6c8250836e4ed0..3c3c0ecdfc49b50fcdb963ff01e1373cbf08c494 100644 (file)
@@ -107,8 +107,8 @@ ssize_t tls_prng_file_read(TLS_PRNG_SRC *fh, size_t len)
 {
     const char *myname = "tls_prng_file_read";
     char    buffer[8192];
-    int     to_read;
-    int     count;
+    ssize_t to_read;
+    ssize_t count;
 
     if (msg_verbose)
        msg_info("%s: seed internal pool from file %s", myname, fh->name);
index e9e17249732c28c79bf8d353b20b0049ebec2e34..d141967ee6446dc1534cd246972c2c16ce5ced5e 100644 (file)
@@ -160,11 +160,11 @@ typedef struct {
 
 static VSTRING *tls_scache_encode(TLS_SCACHE *cp, const char *cache_id,
                                          const char *session,
-                                         int session_len)
+                                         ssize_t session_len)
 {
     TLS_SCACHE_ENTRY *entry;
     VSTRING *hex_data;
-    int     binary_data_len;
+    ssize_t binary_data_len;
 
     /*
      * Assemble the TLS session cache entry.
@@ -187,9 +187,9 @@ static VSTRING *tls_scache_encode(TLS_SCACHE *cp, const char *cache_id,
      * Logging.
      */
     if (cp->log_level >= 3)
-       msg_info("write %s TLS cache entry %s: time=%ld [data %d bytes]",
+       msg_info("write %s TLS cache entry %s: time=%ld [data %ld bytes]",
                 cp->cache_label, cache_id, (long) entry->timestamp,
-                session_len);
+                (long) session_len);
 
     /*
      * Clean up.
@@ -202,7 +202,7 @@ static VSTRING *tls_scache_encode(TLS_SCACHE *cp, const char *cache_id,
 /* tls_scache_decode - decode TLS session cache entry */
 
 static int tls_scache_decode(TLS_SCACHE *cp, const char *cache_id,
-                                    const char *hex_data, int hex_data_len,
+                                    const char *hex_data, ssize_t hex_data_len,
                                     VSTRING *out_session)
 {
     TLS_SCACHE_ENTRY *entry;
@@ -236,9 +236,9 @@ static int tls_scache_decode(TLS_SCACHE *cp, const char *cache_id,
      * Logging.
      */
     if (cp->log_level >= 3)
-       msg_info("read %s TLS cache entry %s: time=%ld [data %d bytes]",
+       msg_info("read %s TLS cache entry %s: time=%ld [data %ld bytes]",
                 cp->cache_label, cache_id, (long) entry->timestamp,
-                LEN(bin_data) - offsetof(TLS_SCACHE_ENTRY, session));
+                (long) (LEN(bin_data) - offsetof(TLS_SCACHE_ENTRY, session)));
 
     /*
      * Other mandatory restrictions.
@@ -299,7 +299,7 @@ int     tls_scache_lookup(TLS_SCACHE *cp, const char *cache_id,
 /* tls_scache_update - save session to cache */
 
 int     tls_scache_update(TLS_SCACHE *cp, const char *cache_id,
-                                 const char *buf, int len)
+                                 const char *buf, ssize_t len)
 {
     VSTRING *hex_data;
 
@@ -307,8 +307,8 @@ int     tls_scache_update(TLS_SCACHE *cp, const char *cache_id,
      * Logging.
      */
     if (cp->log_level >= 3)
-       msg_info("put %s session id=%s [data %d bytes]",
-                cp->cache_label, cache_id, len);
+       msg_info("put %s session id=%s [data %ld bytes]",
+                cp->cache_label, cache_id, (long) len);
 
     /*
      * Encode the cache entry.
index dd545d656f7a8b76520c0456a05e020cdded6fcd..0eb88ab0b7a52803706efd2bbb82dd606809e2ae 100644 (file)
@@ -34,7 +34,7 @@ typedef struct {
 extern TLS_SCACHE *tls_scache_open(const char *, const char *, int, int);
 extern void tls_scache_close(TLS_SCACHE *);
 extern int tls_scache_lookup(TLS_SCACHE *, const char *, VSTRING *);
-extern int tls_scache_update(TLS_SCACHE *, const char *, const char *, int);
+extern int tls_scache_update(TLS_SCACHE *, const char *, const char *, ssize_t);
 extern int tls_scache_delete(TLS_SCACHE *, const char *);
 extern int tls_scache_sequence(TLS_SCACHE *, int, char **, VSTRING *);
 
index 488d116b8e4560d94d1db190a4934085504389f2..2df0edcb1c846ebba7eb2144762d538dde9bf7ce 100644 (file)
@@ -592,7 +592,7 @@ TLScontext_t *tls_server_start(SSL_CTX *server_ctx, VSTREAM *stream,
        if (X509_digest(peer, EVP_md5(), TLScontext->md, &n)) {
            for (j = 0; j < (int) n; j++) {
                TLScontext->fingerprint[j * 3] =
-                   hexcodes[(TLScontext->md[j] & 0xf0) >> 4];
+                   hexcodes[(TLScontext->md[j] & 0xf0) >> 4U];
                TLScontext->fingerprint[(j * 3) + 1] =
                    hexcodes[(TLScontext->md[j] & 0x0f)];
                if (j + 1 != (int) n)
index 5a013f356e4cc6f9e8921a71d52a0ec5db280a6a..212edb56ba4de6106a961b2ade2013d373d559b4 100644 (file)
 
 /* tls_timed_read - read content from stream, then TLS decapsulate */
 
-static int tls_timed_read(int fd, void *buf, unsigned len, int timeout,
-                                 void *context)
+static ssize_t tls_timed_read(int fd, void *buf, size_t len, int timeout,
+                                     void *context)
 {
     char   *myname = "tls_timed_read";
-    int     ret;
+    ssize_t ret;
     TLScontext_t *TLScontext;
 
     TLScontext = (TLScontext_t *) context;
@@ -80,15 +80,15 @@ static int tls_timed_read(int fd, void *buf, unsigned len, int timeout,
 
     ret = tls_bio_read(fd, buf, len, timeout, TLScontext);
     if (ret > 0 && TLScontext->log_level >= 4)
-       msg_info("Read %d chars: %.*s",
-                ret, ret > 40 ? 40 : ret, (char *) buf);
+       msg_info("Read %ld chars: %.*s",
+                (long) ret, (int) (ret > 40 ? 40 : ret), (char *) buf);
     return (ret);
 }
 
 /* tls_timed_write - TLS encapsulate content, then write to stream */
 
-static int tls_timed_write(int fd, void *buf, unsigned len, int timeout,
-                                  void *context)
+static ssize_t tls_timed_write(int fd, void *buf, size_t len, int timeout,
+                                      void *context)
 {
     const char *myname = "tls_timed_write";
     TLScontext_t *TLScontext;
@@ -98,14 +98,14 @@ static int tls_timed_write(int fd, void *buf, unsigned len, int timeout,
        msg_panic("%s: no context", myname);
 
     if (TLScontext->log_level >= 4)
-       msg_info("Write %d chars: %.*s",
-                len, (int) (len > 40 ? 40 : len), (char *) buf);
+       msg_info("Write %ld chars: %.*s",
+                (long) len, (int) (len > 40 ? 40 : len), (char *) buf);
     return (tls_bio_write(fd, buf, len, timeout, TLScontext));
 }
 
 /* tls_stream_start - start VSTREAM over TLS */
 
-void    tls_stream_start(VSTREAM *stream, TLScontext_t * context)
+void    tls_stream_start(VSTREAM *stream, TLScontext_t *context)
 {
     vstream_control(stream,
                    VSTREAM_CTL_READ_FN, tls_timed_read,
index ed5af4b2c78855c7277465c306cc66a78398c501..f125838848e4855f6ac2c525a6f7084418ba3402 100644 (file)
@@ -146,7 +146,7 @@ static void resolve_addr(RES_CONTEXT *rp, char *addr,
     char   *destination;
     const char *blame = 0;
     const char *rcpt_domain;
-    int     addr_len;
+    ssize_t addr_len;
     int     loop_count;
     int     loop_max;
     char   *local;
index 6bb9f023833ca06159f5187bc0fde1ca871445d9..94b2754b23db81798808c14a46d021698a545f51 100644 (file)
 /*     Available in Postfix 2.2 and later:
 /* .IP "\fBremote_header_rewrite_domain (empty)\fR"
 /*     Don't rewrite message headers from remote clients at all when
-/*     this parameter is empty; otherwise, rewrite remote message headers
-/*     and append the specified domain name to incomplete addresses.
+/*     this parameter is empty; otherwise, rewrite message headers and
+/*     append the specified domain name to incomplete addresses.
 /* ROUTING CONTROLS
 /* .ad
 /* .fi
index 33f1843d1bcbf56a52667bc2f31f1a69ed3e8334..5ed42a4d8909a00b0ac0a2dfd063e4d37d7753bb 100644 (file)
@@ -7,7 +7,7 @@
 /*     #include <argv.h>
 /*
 /*     ARGV    *argv_alloc(len)
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     ARGV    *argv_free(argvp)
 /*     ARGV    *argvp;
 /*     void    argv_addn(argvp, arg, arg_len, ..., ARGV_END)
 /*     ARGV    *argvp;
 /*     char    *arg;
-/*     int     arg_len;
+/*     ssize_t arg_len;
 /*
 /*     void    argv_terminate(argvp);
 /*     ARGV    *argvp;
 /*
 /*     void    argv_truncate(argvp, len);
 /*     ARGV    *argvp;
-/*     int     len;
+/*     ssize_t len;
 /* DESCRIPTION
 /*     The functions in this module manipulate arrays of string
 /*     pointers. An ARGV structure contains the following members:
@@ -100,10 +100,10 @@ ARGV   *argv_free(ARGV *argvp)
 
 /* argv_alloc - initialize string array */
 
-ARGV   *argv_alloc(int len)
+ARGV   *argv_alloc(ssize_t len)
 {
     ARGV   *argvp;
-    int     sane_len;
+    ssize_t sane_len;
 
     /*
      * Make sure that always argvp->argc < argvp->len.
@@ -122,7 +122,7 @@ ARGV   *argv_alloc(int len)
 
 static void argv_extend(ARGV *argvp)
 {
-    int     new_len;
+    ssize_t new_len;
 
     new_len = argvp->len * 2;
     argvp->argv = (char **)
@@ -157,7 +157,7 @@ void    argv_add(ARGV *argvp,...)
 void    argv_addn(ARGV *argvp,...)
 {
     char   *arg;
-    int     len;
+    ssize_t len;
     va_list ap;
 
     /*
@@ -165,8 +165,8 @@ void    argv_addn(ARGV *argvp,...)
      */
     va_start(ap, argvp);
     while ((arg = va_arg(ap, char *)) != 0) {
-       if ((len = va_arg(ap, int)) < 0)
-           msg_panic("argv_addn: bad string length %d", len);
+       if ((len = va_arg(ap, ssize_t)) < 0)
+           msg_panic("argv_addn: bad string length %ld", (long) len);
        if (ARGV_SPACE_LEFT(argvp) <= 0)
            argv_extend(argvp);
        argvp->argv[argvp->argc++] = mystrndup(arg, len);
@@ -188,7 +188,7 @@ void    argv_terminate(ARGV *argvp)
 
 /* argv_truncate - truncate string array */
 
-void    argv_truncate(ARGV *argvp, int len)
+void    argv_truncate(ARGV *argvp, ssize_t len)
 {
     char  **cpp;
 
@@ -196,7 +196,7 @@ void    argv_truncate(ARGV *argvp, int len)
      * Sanity check.
      */
     if (len < 0)
-       msg_panic("argv_truncate: bad length %d", len);
+       msg_panic("argv_truncate: bad length %ld", (long) len);
 
     if (len < argvp->argc) {
        for (cpp = argvp->argv + len; cpp < argvp->argv + argvp->argc; cpp++)
index 9c0e7585131b75f582a8a66d71a3e64669c94d92..f369c084d19fbb0950805b1c11224dfa9ef31f94 100644 (file)
   * External interface.
   */
 typedef struct ARGV {
-    int     len;                       /* number of array elements */
-    int     argc;                      /* array elements in use */
+    ssize_t len;                       /* number of array elements */
+    ssize_t argc;                      /* array elements in use */
     char  **argv;                      /* string array */
 } ARGV;
 
-extern ARGV *argv_alloc(int);
+extern ARGV *argv_alloc(ssize_t);
 extern void argv_add(ARGV *,...);
 extern void argv_addn(ARGV *,...);
 extern void argv_terminate(ARGV *);
-extern void argv_truncate(ARGV *, int);
+extern void argv_truncate(ARGV *, ssize_t);
 extern ARGV *argv_free(ARGV *);
 
 extern ARGV *argv_split(const char *, const char *);
index 505b13a521e8e101186bd1ac23deda1d4bc9835f..130615b9b350a119a0e0ceabca29b333d521256c 100644 (file)
@@ -223,7 +223,7 @@ int     attr_clnt_request(ATTR_CLNT *client, int send_flags,...)
                        SKIP_ARG(ap, char *);
                        break;
                    case ATTR_TYPE_DATA:
-                       SKIP_ARG2(ap, char *, int);
+                       SKIP_ARG2(ap, ssize_t, char *);
                        break;
                    case ATTR_TYPE_NUM:
                        SKIP_ARG(ap, int);
index 26a6a394fb79118840fdc8899ece6ffcd999a897..04222e459b2f4ca04a37764de6368d0a968ec9a1 100644 (file)
@@ -51,7 +51,7 @@
 /* .IP "ATTR_TYPE_STR (char *, char *)"
 /*     This argument is followed by an attribute name and a null-terminated
 /*     string.
-/* .IP "ATTR_TYPE_DATA (char *, int, char *)"
+/* .IP "ATTR_TYPE_DATA (char *, ssize_t, char *)"
 /*     This argument is followed by an attribute name, an attribute value
 /*     length, and an attribute value pointer.
 /* .IP "ATTR_TYPE_FUNC (ATTR_PRINT_SLAVE_FN, void *)"
@@ -113,7 +113,7 @@ int     attr_vprint0(VSTREAM *fp, int flags, va_list ap)
     char   *str_val;
     HTABLE_INFO **ht_info_list;
     HTABLE_INFO **ht;
-    int     len_val;
+    ssize_t len_val;
     static VSTRING *base64_buf;
     ATTR_PRINT_SLAVE_FN print_fn;
     void   *print_arg;
@@ -159,14 +159,15 @@ int     attr_vprint0(VSTREAM *fp, int flags, va_list ap)
        case ATTR_TYPE_DATA:
            attr_name = va_arg(ap, char *);
            vstream_fwrite(fp, attr_name, strlen(attr_name) + 1);
-           len_val = va_arg(ap, int);
+           len_val = va_arg(ap, ssize_t);
            str_val = va_arg(ap, char *);
            if (base64_buf == 0)
                base64_buf = vstring_alloc(10);
            base64_encode(base64_buf, str_val, len_val);
            vstream_fwrite(fp, STR(base64_buf), LEN(base64_buf) + 1);
            if (msg_verbose)
-               msg_info("send attr %s = [data %d bytes]", attr_name, len_val);
+               msg_info("send attr %s = [data %ld bytes]",
+                        attr_name, (long) len_val);
            break;
        case ATTR_TYPE_FUNC:
            print_fn = va_arg(ap, ATTR_PRINT_SLAVE_FN);
index 4d4704310180aa967ab2b432c49b9f661000b42e..46aaa7631d91258b51f6faceab0036232ff9c2c4 100644 (file)
@@ -51,6 +51,9 @@
 /* .IP "ATTR_TYPE_STR (char *, char *)"
 /*     This argument is followed by an attribute name and a null-terminated
 /*     string.
+/* .IP "ATTR_TYPE_DATA (char *, ssize_t, char *)"
+/*     This argument is followed by an attribute name, an attribute value
+/*     length, and an attribute value pointer.
 /* .IP "ATTR_TYPE_FUNC (ATTR_PRINT_SLAVE_FN, void *)"
 /*     This argument is followed by a function pointer and generic data
 /*     pointer. The caller-specified function returns whatever the
 
 /* attr_print64_str - encode and send attribute information */
 
-static void attr_print64_str(VSTREAM *fp, const char *str, int len)
+static void attr_print64_str(VSTREAM *fp, const char *str, ssize_t len)
 {
     static VSTRING *base64_buf;
 
@@ -145,7 +148,7 @@ int     attr_vprint64(VSTREAM *fp, int flags, va_list ap)
     char   *str_val;
     HTABLE_INFO **ht_info_list;
     HTABLE_INFO **ht;
-    int     len_val;
+    ssize_t len_val;
     ATTR_PRINT_SLAVE_FN print_fn;
     void   *print_arg;
 
@@ -194,13 +197,14 @@ int     attr_vprint64(VSTREAM *fp, int flags, va_list ap)
        case ATTR_TYPE_DATA:
            attr_name = va_arg(ap, char *);
            attr_print64_str(fp, attr_name, strlen(attr_name));
-           len_val = va_arg(ap, int);
+           len_val = va_arg(ap, ssize_t);
            str_val = va_arg(ap, char *);
            VSTREAM_PUTC(':', fp);
            attr_print64_str(fp, str_val, len_val);
            VSTREAM_PUTC('\n', fp);
            if (msg_verbose)
-               msg_info("send attr %s = [data %d bytes]", attr_name, len_val);
+               msg_info("send attr %s = [data %ld bytes]",
+                        attr_name, (long) len_val);
            break;
        case ATTR_TYPE_FUNC:
            print_fn = va_arg(ap, ATTR_PRINT_SLAVE_FN);
@@ -260,14 +264,14 @@ int     main(int unused_argc, char **argv)
                 ATTR_TYPE_NUM, ATTR_NAME_NUM, 4711,
                 ATTR_TYPE_LONG, ATTR_NAME_LONG, 1234,
                 ATTR_TYPE_STR, ATTR_NAME_STR, "whoopee",
-                ATTR_TYPE_DATA, ATTR_NAME_DATA, strlen("whoopee"), "whoopee",
+              ATTR_TYPE_DATA, ATTR_NAME_DATA, strlen("whoopee"), "whoopee",
                 ATTR_TYPE_HASH, table,
                 ATTR_TYPE_END);
     attr_print64(VSTREAM_OUT, ATTR_FLAG_NONE,
                 ATTR_TYPE_NUM, ATTR_NAME_NUM, 4711,
                 ATTR_TYPE_LONG, ATTR_NAME_LONG, 1234,
                 ATTR_TYPE_STR, ATTR_NAME_STR, "whoopee",
-                ATTR_TYPE_DATA, ATTR_NAME_DATA, strlen("whoopee"), "whoopee",
+              ATTR_TYPE_DATA, ATTR_NAME_DATA, strlen("whoopee"), "whoopee",
                 ATTR_TYPE_END);
     if (vstream_fflush(VSTREAM_OUT) != 0)
        msg_fatal("write error: %m");
index 5fb6b6684452ffa81223512bb15e8fcba407e32b..aea66b5c48a30b6062ef039b1b878ae9b85043cf 100644 (file)
@@ -51,7 +51,7 @@
 /* .IP "ATTR_TYPE_STR (char *, char *)"
 /*     This argument is followed by an attribute name and a null-terminated
 /*     string.
-/* .IP "ATTR_TYPE_DATA (char *, int, char *)"
+/* .IP "ATTR_TYPE_DATA (char *, ssize_t, char *)"
 /*     This argument is followed by an attribute name, an attribute value
 /*     length, and a pointer to attribute value.
 /* .IP "ATTR_TYPE_FUNC (ATTR_PRINT_SLAVE_FN, void *)"
@@ -115,7 +115,7 @@ int     attr_vprint_plain(VSTREAM *fp, int flags, va_list ap)
     HTABLE_INFO **ht_info_list;
     HTABLE_INFO **ht;
     static VSTRING *base64_buf;
-    int     len_val;
+    ssize_t len_val;
     ATTR_PRINT_SLAVE_FN print_fn;
     void   *print_arg;
 
@@ -154,14 +154,15 @@ int     attr_vprint_plain(VSTREAM *fp, int flags, va_list ap)
            break;
        case ATTR_TYPE_DATA:
            attr_name = va_arg(ap, char *);
-           len_val = va_arg(ap, int);
+           len_val = va_arg(ap, ssize_t);
            str_val = va_arg(ap, char *);
            if (base64_buf == 0)
                base64_buf = vstring_alloc(10);
            base64_encode(base64_buf, str_val, len_val);
            vstream_fprintf(fp, "%s=%s\n", attr_name, STR(base64_buf));
            if (msg_verbose)
-               msg_info("send attr %s = [data %d bytes]", attr_name, len_val);
+               msg_info("send attr %s = [data %ld bytes]",
+                        attr_name, (long) len_val);
            break;
        case ATTR_TYPE_FUNC:
            print_fn = va_arg(ap, ATTR_PRINT_SLAVE_FN);
@@ -218,14 +219,14 @@ int     main(int unused_argc, char **argv)
                     ATTR_TYPE_NUM, ATTR_NAME_NUM, 4711,
                     ATTR_TYPE_LONG, ATTR_NAME_LONG, 1234,
                     ATTR_TYPE_STR, ATTR_NAME_STR, "whoopee",
-                    ATTR_TYPE_DATA, ATTR_NAME_DATA, strlen("whoopee"), "whoopee",
+              ATTR_TYPE_DATA, ATTR_NAME_DATA, strlen("whoopee"), "whoopee",
                     ATTR_TYPE_HASH, table,
                     ATTR_TYPE_END);
     attr_print_plain(VSTREAM_OUT, ATTR_FLAG_NONE,
                     ATTR_TYPE_NUM, ATTR_NAME_NUM, 4711,
                     ATTR_TYPE_LONG, ATTR_NAME_LONG, 1234,
                     ATTR_TYPE_STR, ATTR_NAME_STR, "whoopee",
-                    ATTR_TYPE_DATA, ATTR_NAME_DATA, strlen("whoopee"), "whoopee",
+              ATTR_TYPE_DATA, ATTR_NAME_DATA, strlen("whoopee"), "whoopee",
                     ATTR_TYPE_END);
     if (vstream_fflush(VSTREAM_OUT) != 0)
        msg_fatal("write error: %m");
index 27f60a685712f57cab3d2881c7f80929d1d49dd4..db1f1fa0088c4ab2b51a4d334efee8eb809f2b86 100644 (file)
@@ -297,7 +297,7 @@ int     attr_vscan0(VSTREAM *fp, int flags, va_list ap)
            } else if (wanted_type == ATTR_TYPE_HASH) {
                wanted_name = "(any attribute name or list terminator)";
                hash_table = va_arg(ap, HTABLE *);
-               if (va_arg(ap, int) !=ATTR_TYPE_END)
+               if (va_arg(ap, int) != ATTR_TYPE_END)
                    msg_panic("%s: ATTR_TYPE_HASH not followed by ATTR_TYPE_END",
                              myname);
            } else if (wanted_type != ATTR_TYPE_FUNC) {
index 8cf4808129db67102509e78240fbe670e26e3031..2d5b6936faff0e0b3a53dd5aae4450ee577226f9 100644 (file)
@@ -300,7 +300,7 @@ int     attr_vscan64(VSTREAM *fp, int flags, va_list ap)
            } else if (wanted_type == ATTR_TYPE_HASH) {
                wanted_name = "(any attribute name or list terminator)";
                hash_table = va_arg(ap, HTABLE *);
-               if (va_arg(ap, int) !=ATTR_TYPE_END)
+               if (va_arg(ap, int) != ATTR_TYPE_END)
                    msg_panic("%s: ATTR_TYPE_HASH not followed by ATTR_TYPE_END",
                              myname);
            } else if (wanted_type != ATTR_TYPE_FUNC) {
index 79c119cf578f816673b0dead546dde67ea3b72ce..70f216e6a7376475c667b3ae112c24abe66b2941 100644 (file)
@@ -313,7 +313,7 @@ int     attr_vscan_plain(VSTREAM *fp, int flags, va_list ap)
            } else if (wanted_type == ATTR_TYPE_HASH) {
                wanted_name = "(any attribute name or list terminator)";
                hash_table = va_arg(ap, HTABLE *);
-               if (va_arg(ap, int) !=ATTR_TYPE_END)
+               if (va_arg(ap, int) != ATTR_TYPE_END)
                    msg_panic("%s: ATTR_TYPE_HASH not followed by ATTR_TYPE_END",
                              myname);
            } else if (wanted_type != ATTR_TYPE_FUNC) {
index 22573c4f0249b03327956cbc1d91a7fd593cbec4..fa9355528fbfcf8de29c136ec69f43635ba79b43 100644 (file)
@@ -9,12 +9,12 @@
 /*     VSTRING *base64_encode(result, in, len)
 /*     VSTRING *result;
 /*     const char *in;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     VSTRING *base64_decode(result, in, len)
 /*     VSTRING *result;
 /*     const char *in;
-/*     int     len;
+/*     ssize_t len;
 /* DESCRIPTION
 /*     base64_encode() takes a block of len bytes and encodes it as one
 /*     null-terminated string.  The result value is the result argument.
@@ -63,10 +63,10 @@ static unsigned char to_b64[] =
 
 /* base64_encode - raw data to encoded */
 
-VSTRING *base64_encode(VSTRING *result, const char *in, int len)
+VSTRING *base64_encode(VSTRING *result, const char *in, ssize_t len)
 {
     const unsigned char *cp;
-    int     count;
+    ssize_t count;
 
     /*
      * Encode 3 -> 4.
@@ -97,11 +97,11 @@ VSTRING *base64_encode(VSTRING *result, const char *in, int len)
 
 /* base64_decode - encoded data to raw */
 
-VSTRING *base64_decode(VSTRING *result, const char *in, int len)
+VSTRING *base64_decode(VSTRING *result, const char *in, ssize_t len)
 {
     static unsigned char *un_b64 = 0;
     const unsigned char *cp;
-    int     count;
+    ssize_t count;
     unsigned int ch0;
     unsigned int ch1;
     unsigned int ch2;
index d018947e1c1e2f5d9506d18694d3c98092c16627..e2f938ac4bccd45b5606361309b8ee72f7bc76a0 100644 (file)
@@ -19,8 +19,8 @@
  /*
   * External interface.
   */
-extern VSTRING *base64_encode(VSTRING *, const char *, int);
-extern VSTRING *base64_decode(VSTRING *, const char *, int);
+extern VSTRING *base64_encode(VSTRING *, const char *, ssize_t);
+extern VSTRING *base64_decode(VSTRING *, const char *, ssize_t);
 
 /* LICENSE
 /* .ad
index 8e9a8e60865cf51bb696ff6d2c205b153669efce..b877f77eecace78e0c9ab69bbcc2794447b689cf 100644 (file)
@@ -134,9 +134,9 @@ static unsigned binhash_hash(const char *key, int len, unsigned size)
      */
 
     while (len-- > 0) {
-       h = (h << 4) + *key++;
+       h = (h << 4U) + *key++;
        if ((g = (h & 0xf0000000)) != 0) {
-           h ^= (g >> 24);
+           h ^= (g >> 24U);
            h ^= g;
        }
     }
index 14023dfe2eb5802d163443a56a700461bfa408b0..ec337cdf06a1d332c8efa77fa00ee7cbd8a87056 100644 (file)
@@ -56,7 +56,7 @@ void    clean_env(char **preserve_list)
     /*
      * Preserve or specify selected environment variables.
      */
-#define STRING_AND_LENGTH(x, y) (x), (y)
+#define STRING_AND_LENGTH(x, y) (x), (ssize_t) (y)
 
     save_list = argv_alloc(10);
     for (cpp = preserve_list; *cpp; cpp++)
index cf0d45d1b66270ad78f7a79a71c22d78b24a7efe..1f9716074c166059b233573419d48db03807d577 100644 (file)
@@ -42,7 +42,7 @@ char   *concatenate(const char *arg0,...)
 {
     char   *result;
     va_list ap;
-    int     len;
+    ssize_t len;
     char   *arg;
 
     /*
index 1c596ffea632c4e52a466b70b5daf98f2ce5077a..6d8d11c8d755ab366fc32f096b082e734c1cf29b 100644 (file)
@@ -194,8 +194,8 @@ static DICT *dict_cdbq_open(const char *path, int dict_flags)
      * the source file changed only seconds ago.
      */
     if (stat(path, &st) == 0
-       && st.st_mtime > dict_cdbq->dict.mtime
-       && st.st_mtime < time((time_t *)0) - 100)
+       && st.st_mtime > dict_cdbq->dict.mtime
+       && st.st_mtime < time((time_t *) 0) - 100)
        msg_warn("database %s is older than source file %s", cdb_path, path);
 
     /*
@@ -215,8 +215,7 @@ static DICT *dict_cdbq_open(const char *path, int dict_flags)
 static void dict_cdbm_update(DICT *dict, const char *name, const char *value)
 {
     DICT_CDBM *dict_cdbm = (DICT_CDBM *) dict;
-    unsigned ksize,
-            vsize;
+    unsigned ksize, vsize;
     int     r;
 
     ksize = strlen(name);
@@ -294,8 +293,7 @@ static DICT *dict_cdbm_open(const char *path, int dict_flags)
     char   *cdb_path;
     char   *tmp_path;
     int     fd;
-    struct stat st0,
-            st1;
+    struct stat st0, st1;
 
     cdb_path = concatenate(path, CDB_SUFFIX, (char *) 0);
     tmp_path = concatenate(path, CDB_TMP_SUFFIX, (char *) 0);
@@ -369,7 +367,7 @@ static DICT *dict_cdbm_open(const char *path, int dict_flags)
 DICT   *dict_cdb_open(const char *path, int open_flags, int dict_flags)
 {
     switch (open_flags & (O_RDONLY | O_RDWR | O_WRONLY | O_CREAT | O_TRUNC)) {
-    case O_RDONLY:                             /* query mode */
+       case O_RDONLY:                  /* query mode */
        return dict_cdbq_open(path, dict_flags);
     case O_WRONLY | O_CREAT | O_TRUNC:         /* create mode */
     case O_RDWR | O_CREAT | O_TRUNC:           /* sloppiness */
index dafb687df5106efe58dc54323d558169877fd517..c6497f8888c049437a51249a43468a5c03296696 100644 (file)
@@ -102,9 +102,7 @@ static const char *dict_ni_do_lookup(char *path, char *key_prop,
            if (values.ni_namelist_len <= 0)
                ni_namelist_free(&values);
            else {
-               unsigned int i,
-                       l,
-                       n;
+               unsigned int i, l, n;
 
                for (i = l = 0; i < values.ni_namelist_len; i++)
                    l += 1 + strlen(values.ni_namelist_val[i]);
@@ -174,7 +172,7 @@ DICT   *dict_ni_open(const char *path, int unused_flags, int dict_flags)
     d->dict.close = dict_ni_close;
     d->dict.flags = dict_flags | DICT_FLAG_FIXED;
 
-    return (DICT_DEBUG(&d->dict));
+    return (DICT_DEBUG (&d->dict));
 }
 
 #endif
index f70dc38cb2be2ed798d373e5e1a842f793fe6fec..6369dd41578633f1f77718120f4e1c8096e5d697 100644 (file)
@@ -6,10 +6,10 @@
 /* SYNOPSIS
 /*     #include <iostuff.h>
 /*
-/*     int     dummy_read(fd, buf, buf_len, timeout, context)
+/*     ssize_t dummy_read(fd, buf, buf_len, timeout, context)
 /*     int     fd;
 /*     void    *buf;
-/*     unsigned len;
+/*     size_t  len;
 /*     int     timeout;
 /*     void    *context;
 /* DESCRIPTION
 
 /* dummy_read - dummy read operation */
 
-int     dummy_read(int fd, void *unused_buf, unsigned len,
+ssize_t dummy_read(int fd, void *unused_buf, size_t len,
                           int unused_timeout, void *unused_context)
 {
     if (msg_verbose)
-       msg_info("dummy_read: fd %d, len %d", fd, len);
+       msg_info("dummy_read: fd %d, len %lu", fd, (unsigned long) len);
     return (0);
 }
index a9e69695b574ac5234bcca328ed89a35b225b94d..5b7b1e0f4edd1ad5bd192a676be1aa891d39c5a9 100644 (file)
@@ -6,10 +6,10 @@
 /* SYNOPSIS
 /*     #include <iostuff.h>
 /*
-/*     int     dummy_write(fd, buf, buf_len, timeout, context)
+/*     ssize_t dummy_write(fd, buf, buf_len, timeout, context)
 /*     int     fd;
 /*     void    *buf;
-/*     unsigned len;
+/*     size_t  len;
 /*     int     timeout;
 /*     void    *context;
 /* DESCRIPTION
 
 /* dummy_write - dummy write operation */
 
-int     dummy_write(int fd, void *unused_buf, unsigned len,
-                          int unused_timeout, void *unused_context)
+ssize_t dummy_write(int fd, void *unused_buf, size_t len,
+                           int unused_timeout, void *unused_context)
 {
     if (msg_verbose)
-       msg_info("dummy_write: fd %d, len %d", fd, len);
+       msg_info("dummy_write: fd %d, len %lu", fd, (unsigned long) len);
     return (len);
 }
index 9ab982ca064d532b998f6cab8e1dd877e3bf1f12..df0e21cd37f0c907f9f9c4a57c7d1c3446d6aa80 100644 (file)
@@ -30,6 +30,8 @@
 
 #include <stdio.h>
 #include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 #define DO(s)  if (s < 0) { perror(#s); exit(1); }
 
index cec1a865cf0e98806846945a894a56c3c83f517c..294ca199bd8178aab4306f58302dd2302123a049 100644 (file)
@@ -24,7 +24,7 @@ static int allocated = 0;             /* environ is, or is not, allocated */
 
 /* namelength - determine length of name in "name=whatever" */
 
-static int namelength(const char *name)
+static ssize_t namelength(const char *name)
 {
     char   *equal;
 
@@ -115,7 +115,7 @@ int     setenv(const char *name, const char *value, int clobber)
 
 /* cmalloc - malloc and copy block of memory */
 
-static char *cmalloc(int new_len, char *old, int old_len)
+static char *cmalloc(ssize_t new_len, char *old, ssize_t old_len)
 {
     char   *new = malloc(new_len);
 
@@ -129,9 +129,9 @@ static char *cmalloc(int new_len, char *old, int old_len)
 static int addenv(char *nameval)
 {
     char  **envp;
-    int     n_used;                    /* number of environment entries */
-    int     l_used;                    /* bytes used excl. terminator */
-    int     l_need;                    /* bytes needed incl. terminator */
+    ssize_t n_used;                    /* number of environment entries */
+    ssize_t l_used;                    /* bytes used excl. terminator */
+    ssize_t l_need;                    /* bytes needed incl. terminator */
 
     for (envp = environ; envp && *envp; envp++)
         /* void */ ;
index 379e31c7f45f6ae7e931ecc9754bf857debacb6d..fa8e2daeef3bf11ce9a612cba041ad6717cd2ca6 100644 (file)
@@ -619,6 +619,7 @@ void    event_loop(int delay)
   */
 #include <stdio.h>
 #include <ctype.h>
+#include <stdlib.h>
 
 /* timer_event - display event */
 
index 6ea988a13718a8e104973c6bebdf18612fc6459d..1587779e0a1f2e46891226b807b7feb5db1b30c7 100644 (file)
@@ -27,6 +27,7 @@
 #include <fcntl.h>
 #include <signal.h>
 #include <unistd.h>
+#include <stdlib.h>
 
 #define FIFO_PATH      "test-fifo"
 #define perrorexit(s)  { perror(s); exit(1); }
index 5c1355634c67ed7c134a570995172db4478ad05d..bf93467be81f46151d9e6e2288d3ab87a04bc38b 100644 (file)
@@ -31,6 +31,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <fcntl.h>
+#include <string.h>
 
 #define FIFO_PATH      "test-fifo"
 #define TRIGGER_DELAY  5
index c9be211c6f04cba1ecf7e2682e91602649185b8e..2486876d527ebd5756373f924c13b680310b23d0 100644 (file)
@@ -32,6 +32,7 @@
 #include <signal.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <string.h>
 
 #define FIFO_PATH       "test-fifo"
 #define perrorexit(s)   { perror(s); exit(1); }
index 841011a1bfc39cc9264b7e717468c02582c8be66..8b56cf02cd460799f2ce5b8a820813b9b0718f45 100644 (file)
@@ -9,7 +9,7 @@
 /*     int     fifo_trigger(service, buf, len, timeout)
 /*     const char *service;
 /*     const char *buf;
-/*     int     len;
+/*     ssize_t len;
 /*     int     timeout;
 /* DESCRIPTION
 /*     fifo_trigger() wakes up the named fifo server by writing
@@ -55,7 +55,7 @@
 
 /* fifo_trigger - wakeup fifo server */
 
-int     fifo_trigger(const char *service, const char *buf, int len, int timeout)
+int     fifo_trigger(const char *service, const char *buf, ssize_t len, int timeout)
 {
     static VSTRING *why;
     char   *myname = "fifo_trigger";
@@ -130,7 +130,7 @@ static void handler(int sig)
 
 static void read_event(int unused_event, char *context)
 {
-    int     fd = (int) context;
+    int     fd = CAST_CHAR_PTR_TO_INT(context);
     char    ch;
 
     wakeup_count++;
@@ -145,7 +145,7 @@ int     main(int unused_argc, char **unused_argv)
 
     listen_fd = fifo_listen(TEST_FIFO, 0600, NON_BLOCKING);
     msg_cleanup(cleanup);
-    event_enable_read(listen_fd, read_event, (char *) listen_fd);
+    event_enable_read(listen_fd, read_event, CAST_INT_TO_CHAR_PTR(listen_fd));
     signal(SIGINT, handler);
     signal(SIGALRM, handler);
     for (;;) {
index 6a2868360c436092c1d3247c5d8810b9ab474619..a9d4b32b5c0851fe9ccf8db8d103275db55c396d 100644 (file)
@@ -105,6 +105,7 @@ int     main(int unused_argc, char **unused_argv)
     const char *cp = fullname();
 
     printf("%s\n", cp ? cp : "null!");
+    return (0);
 }
 
 #endif
index 1397b583f2a5d0e3f8342683aefa5f438cfb691e..42d844b88b81851c8bc552833be8f4fc417c1b4e 100644 (file)
@@ -9,12 +9,12 @@
 /*     VSTRING *hex_encode(result, in, len)
 /*     VSTRING *result;
 /*     const char *in;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     VSTRING *hex_decode(result, in, len)
 /*     VSTRING *result;
 /*     const char *in;
-/*     int     len;
+/*     ssize_t len;
 /* DESCRIPTION
 /*     hex_encode() takes a block of len bytes and encodes it as one
 /*      upper-case null-terminated string.  The result value is
@@ -59,11 +59,11 @@ static const unsigned char hex_chars[] = "0123456789ABCDEF";
 
 /* hex_encode - raw data to encoded */
 
-VSTRING *hex_encode(VSTRING *result, const char *in, int len)
+VSTRING *hex_encode(VSTRING *result, const char *in, ssize_t len)
 {
     const unsigned char *cp;
     int     ch;
-    int     count;
+    ssize_t count;
 
     VSTRING_RESET(result);
     for (cp = UCHAR_PTR(in), count = len; count > 0; count--, cp++) {
@@ -77,10 +77,10 @@ VSTRING *hex_encode(VSTRING *result, const char *in, int len)
 
 /* hex_decode - encoded data to raw */
 
-VSTRING *hex_decode(VSTRING *result, const char *in, int len)
+VSTRING *hex_decode(VSTRING *result, const char *in, ssize_t len)
 {
     const unsigned char *cp;
-    int     count;
+    ssize_t count;
     unsigned int hex;
     unsigned int bin;
 
@@ -99,11 +99,11 @@ VSTRING *hex_decode(VSTRING *result, const char *in, int len)
            return (0);
        hex = cp[1];
        if (hex >= '0' && hex <= '9')
-           bin |= (hex - '0') ;
+           bin |= (hex - '0');
        else if (hex >= 'A' && hex <= 'F')
-           bin |= (hex - 'A' + 10) ;
+           bin |= (hex - 'A' + 10);
        else if (hex >= 'a' && hex <= 'f')
-           bin |= (hex - 'a' + 10) ;
+           bin |= (hex - 'a' + 10);
        else
            return (0);
        VSTRING_ADDCH(result, bin);
index d437da16eddcd33cbeb897928c95c92d81b7657c..e868fe6b292991c96ad19c9f3d97c55042b47798 100644 (file)
@@ -19,8 +19,8 @@
  /*
   * External interface.
   */
-extern VSTRING *hex_encode(VSTRING *, const char *, int);
-extern VSTRING *hex_decode(VSTRING *, const char *, int);
+extern VSTRING *hex_encode(VSTRING *, const char *, ssize_t);
+extern VSTRING *hex_decode(VSTRING *, const char *, ssize_t);
 
 /* LICENSE
 /* .ad
index 5c752b4990a31f5a24e22a99036477a4eb129b41..f515441adfefedbb68bb12b236cb90b30007c26f 100644 (file)
@@ -115,9 +115,9 @@ VSTRING *hex_unquote(VSTRING *raw, const char *hex)
 
 #define BUFLEN 1024
 
-static int read_buf(VSTREAM *fp, VSTRING *buf)
+static ssize_t read_buf(VSTREAM *fp, VSTRING *buf)
 {
-    int     len;
+    ssize_t len;
 
     VSTRING_RESET(buf);
     len = vstream_fread(fp, STR(buf), vstring_avail(buf));
@@ -130,14 +130,14 @@ int     main(int unused_argc, char **unused_argv)
 {
     VSTRING *raw = vstring_alloc(BUFLEN);
     VSTRING *hex = vstring_alloc(100);
-    int     len;
+    ssize_t len;
 
     while ((len = read_buf(VSTREAM_IN, raw)) > 0) {
        hex_quote(hex, STR(raw));
        if (hex_unquote(raw, STR(hex)) == 0)
            msg_fatal("bad input: %.100s", STR(hex));
        if (LEN(raw) != len)
-           msg_fatal("len %d != raw len %d", len, LEN(raw));
+           msg_fatal("len %ld != raw len %ld", len, LEN(raw));
        if (vstream_fwrite(VSTREAM_OUT, STR(raw), LEN(raw)) != LEN(raw))
            msg_fatal("write error: %m");
     }
index c64a64b33d968655be73bc434055800c4aaea7c2..e113e6a4c8b111b99f35351f824f593e9d79c7d9 100644 (file)
@@ -128,9 +128,9 @@ static unsigned htable_hash(const char *s, unsigned size)
      */
 
     while (*s) {
-       h = (h << 4) + *s++;
+       h = (h << 4U) + *s++;
        if ((g = (h & 0xf0000000)) != 0) {
-           h ^= (g >> 24);
+           h ^= (g >> 24U);
            h ^= g;
        }
     }
@@ -352,7 +352,7 @@ int main(int unused_argc, char **unused_argv)
      */
     hash = htable_create(10);
     while (vstring_get(buf, VSTREAM_IN) != VSTREAM_EOF)
-       htable_enter(hash, vstring_str(buf), (void *) count++);
+       htable_enter(hash, vstring_str(buf), CAST_INT_TO_CHAR_PTR(count++));
     ht_info = htable_list(hash);
     for (i = 0; i < hash->used; i++) {
        r = myrand() % hash->used;
index 3331ffee08a520fdbd7b480b67eaa25ee7538324..f330e5b5a3f46927158fca7fedcb4f9d8191b7c1 100644 (file)
@@ -64,7 +64,7 @@ int     inet_addr_host(INET_ADDR_LIST *addr_list, const char *hostname)
     struct addrinfo *res0;
     struct addrinfo *res;
     int     aierr;
-    int     hostnamelen;
+    ssize_t hostnamelen;
     const char *hname;
     const char *serv;
     int     initial_count = addr_list->used;
@@ -146,7 +146,8 @@ int     main(int argc, char **argv)
     if (argc < 3)
        msg_fatal("usage: %s protocols hostname...", argv[0]);
 
-    proto_info = inet_proto_init(argv[0], *++argv);
+    proto_info = inet_proto_init(argv[0], argv[1]);
+    argv += 1;
 
     inet_addr_list_init(&list);
 
index 6ebe3eb815105e4c8855cb57f7bee4078668ac71..617c3820b52000acebcaca648be7d2d96159fc00 100644 (file)
@@ -604,6 +604,7 @@ int     main(int unused_argc, char **argv)
     }
     inet_addr_list_free(&addr_list);
     inet_addr_list_free(&mask_list);
+    return (0);
 }
 
 #endif
index dddbcb62aace1cd62c044adf72ebbebf7ca53416..2d27b5f93b10465c95985adfb8015baf55f33299 100644 (file)
@@ -9,7 +9,7 @@
 /*     int     inet_trigger(service, buf, len, timeout)
 /*     char    *service;
 /*     const char *buf;
-/*     int     len;
+/*     ssize_t len;
 /*     int     timeout;
 /* DESCRIPTION
 /*     inet_trigger() wakes up the named INET-domain server by making
@@ -90,7 +90,7 @@ static void inet_trigger_event(int event, char *context)
 
 /* inet_trigger - wakeup INET-domain server */
 
-int     inet_trigger(const char *service, const char *buf, int len, int timeout)
+int     inet_trigger(const char *service, const char *buf, ssize_t len, int timeout)
 {
     char   *myname = "inet_trigger";
     struct inet_trigger *ip;
index 7d04346c8154b046d1868e373b4a9f4fc5011f3c..8d3c7a5ca4d0eedaaf7a30a5dde33e2aa75702b7 100644 (file)
@@ -20,12 +20,12 @@ extern int readable(int);
 extern int writable(int);
 extern off_t get_file_limit(void);
 extern void set_file_limit(off_t);
-extern int peekfd(int);
+extern ssize_t peekfd(int);
 extern int read_wait(int, int);
 extern int write_wait(int, int);
-extern int write_buf(int, const char *, int, int);
-extern int timed_read(int, void *, unsigned, int, void *);
-extern int timed_write(int, void *, unsigned, int, void *);
+extern ssize_t write_buf(int, const char *, ssize_t, int);
+extern ssize_t timed_read(int, void *, size_t, int, void *);
+extern ssize_t timed_write(int, void *, size_t, int, void *);
 extern void doze(unsigned);
 extern void rand_sleep(unsigned, unsigned);
 extern int duplex_pipe(int *);
@@ -33,8 +33,8 @@ extern int stream_recv_fd(int);
 extern int stream_send_fd(int, int);
 extern int unix_recv_fd(int);
 extern int unix_send_fd(int, int);
-extern int dummy_read(int, void *, unsigned, int, void *);
-extern int dummy_write(int, void *, unsigned, int, void *);
+extern ssize_t dummy_read(int, void *, size_t, int, void *);
+extern ssize_t dummy_write(int, void *, size_t, int, void *);
 
 #define BLOCKING       0
 #define NON_BLOCKING   1
index 50d172cabb813327b371293c837a920de0993b8d..38c5558cfc838412ad078253ad26beabfd26afc2 100644 (file)
@@ -73,16 +73,16 @@ void print(const char *str, int len, int indent, char *context)
 
 /* line_wrap - wrap long lines upon output */
 
-void    line_wrap(const char *str, int len, int indent, LINE_WRAP_FN output_fn,
+void    line_wrap(const char *str, ssize_t len, ssize_t indent, LINE_WRAP_FN output_fn,
                          char *context)
 {
     const char *start_line;
     const char *word;
     const char *next_word;
     const char *next_space;
-    int     line_len;
-    int     curr_len;
-    int     curr_indent;
+    ssize_t line_len;
+    ssize_t curr_len;
+    ssize_t curr_indent;
 
     if (indent < 0) {
        curr_indent = -indent;
index b901c1f3dec827b98a0fa3f6bf88dd37e1f24195..d1b0c18ea8aa77a57db9c50955d093a0604146b1 100644 (file)
@@ -14,8 +14,8 @@
  /*
   * External interface.
   */
-typedef void (*LINE_WRAP_FN) (const char *, int, int, char *);
-extern void line_wrap(const char *, int, int, LINE_WRAP_FN, char *);
+typedef void (*LINE_WRAP_FN) (const char *, ssize_t, ssize_t, char *);
+extern void line_wrap(const char *, ssize_t, ssize_t, LINE_WRAP_FN, char *);
 
 /* LICENSE
 /* .ad
index 44724785a0c3a1f05d626a77d68b641d002a6727..3bd304616fec18dd7d96ecb4e339651920b82e01 100644 (file)
@@ -116,13 +116,12 @@ typedef struct {
 
 static int mac_expand_callback(int type, VSTRING *buf, char *ptr)
 {
-    char   *myname = "mac_expand_callback";
     MAC_EXP *mc = (MAC_EXP *) ptr;
     int     lookup_mode;
     const char *text;
     char   *cp;
     int     ch;
-    int     len;
+    ssize_t len;
 
     /*
      * Sanity check.
@@ -244,6 +243,7 @@ int     mac_expand(VSTRING *result, const char *pattern, int flags,
  /*
   * This code certainly deserves a stand-alone test program.
   */
+#include <stdlib.h>
 #include <stringops.h>
 #include <htable.h>
 #include <vstream.h>
index 6bd638d42d07f1c7ec1bf893961022ddfa53415f..22398ad612a1c5c4e651341dfc76e6469d94da40 100644 (file)
@@ -191,6 +191,7 @@ int     main(int unused_argc, char **unused_argv)
        vstream_fflush(VSTREAM_OUT);
     }
     vstring_free(buf);
+    return (0);
 }
 
 #endif
index 19c1d3244d4420b584ea80ac42b51853704799dd..29eff7e1c45a21b025d98895c09d251eceb85cc0 100644 (file)
@@ -213,7 +213,7 @@ int     match_hostaddr(int unused_flags, const char *addr, const char *pattern)
        if (strcasecmp(addr, pattern) == 0)
            return (1);
     } else {
-       int     addr_len = strlen(addr);
+       ssize_t addr_len = strlen(addr);
 
        if (strncasecmp(addr, pattern + 1, addr_len) == 0
            && strcmp(pattern + 1 + addr_len, "]") == 0)
index db2a6045467621fd7e8f3f4c49f4751358dea1b6..941d58b94f17f1101d0a7d86b16e29945648c928 100644 (file)
 #include <string.h>
 #include <errno.h>
 #include <stdlib.h>
+#include <stdio.h>                     /* sprintf() */
 
 /* Utility library. */
 
@@ -536,7 +537,7 @@ int     sockaddr_to_hostaddr(const struct sockaddr * sa, SOCKADDR_SIZE salen,
 {
 #ifdef EMULATE_IPV4_ADDRINFO
     char    portbuf[sizeof("65535")];
-    int     len;
+    ssize_t len;
 
     /*
      * Emulated getnameinfo(3) version. The buffer length includes the space
index 174215d7936e8439189948f37f29d9bb0ebd86d5..91b4af2818955f14096b624df80f96ff1dfa7eb5 100644 (file)
@@ -7,11 +7,11 @@
 /*     #include <mymalloc.h>
 /*
 /*     char    *mymalloc(len)
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     char    *myrealloc(ptr, len)
 /*     char    *ptr;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     void    myfree(ptr)
 /*     char    *ptr;
 /*
 /*     char    *mystrndup(str, len)
 /*     const char *str;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     char    *mymemdup(ptr, len)
 /*     const char *ptr;
-/*     int     len;
+/*     ssize_t len;
 /* DESCRIPTION
 /*     This module performs low-level memory management with error
 /*     handling. A call of these functions either succeeds or it does
   */
 typedef struct MBLOCK {
     int     signature;                 /* set when block is active */
-    int     length;                    /* user requested length */
+    ssize_t length;                    /* user requested length */
     union {
        ALIGN_TYPE align;
        char    payload[1];             /* actually a bunch of bytes */
-    } u;
+    }       u;
 } MBLOCK;
 
 #define SIGNATURE      0xdead
@@ -120,13 +120,13 @@ typedef struct MBLOCK {
 
 /* mymalloc - allocate memory or bust */
 
-char   *mymalloc(int len)
+char   *mymalloc(ssize_t len)
 {
     char   *ptr;
     MBLOCK *real_ptr;
 
     if (len < 1)
-       msg_panic("mymalloc: requested length %d", len);
+       msg_panic("mymalloc: requested length %ld", (long) len);
     if ((real_ptr = (MBLOCK *) malloc(SPACE_FOR(len))) == 0)
        msg_fatal("mymalloc: insufficient memory: %m");
     CHECK_OUT_PTR(ptr, real_ptr, len);
@@ -136,13 +136,13 @@ char   *mymalloc(int len)
 
 /* myrealloc - reallocate memory or bust */
 
-char   *myrealloc(char *ptr, int len)
+char   *myrealloc(char *ptr, ssize_t len)
 {
     MBLOCK *real_ptr;
-    int     old_len;
+    ssize_t old_len;
 
     if (len < 1)
-       msg_panic("myrealloc: requested length %d", len);
+       msg_panic("myrealloc: requested length %ld", (long) len);
     CHECK_IN_PTR(ptr, real_ptr, old_len, "myrealloc");
     if ((real_ptr = (MBLOCK *) realloc((char *) real_ptr, SPACE_FOR(len))) == 0)
        msg_fatal("myrealloc: insufficient memory: %m");
@@ -157,7 +157,7 @@ char   *myrealloc(char *ptr, int len)
 void    myfree(char *ptr)
 {
     MBLOCK *real_ptr;
-    int     len;
+    ssize_t len;
 
     CHECK_IN_PTR(ptr, real_ptr, len, "myfree");
     memset((char *) real_ptr, FILLER, SPACE_FOR(len));
@@ -175,13 +175,15 @@ char   *mystrdup(const char *str)
 
 /* mystrndup - save substring to heap */
 
-char   *mystrndup(const char *str, int len)
+char   *mystrndup(const char *str, ssize_t len)
 {
     char   *result;
     char   *cp;
 
     if (str == 0)
        msg_panic("mystrndup: null pointer argument");
+    if (len < 0)
+       msg_panic("mystrndup: requested length %ld", (long) len);
     if ((cp = memchr(str, 0, len)) != 0)
        len = cp - str;
     result = memcpy(mymalloc(len + 1), str, len);
@@ -191,7 +193,7 @@ char   *mystrndup(const char *str, int len)
 
 /* mymemdup - copy memory */
 
-char   *mymemdup(const char *ptr, int len)
+char   *mymemdup(const char *ptr, ssize_t len)
 {
     if (ptr == 0)
        msg_panic("mymemdup: null pointer argument");
index 9503bcd17e3fc564028c655f53960a42a6d388c6..0c3216d5df6039de6d4aee77b45356c8ac4cb43c 100644 (file)
  /*
   * External interface.
   */
-extern char *mymalloc(int);
-extern char *myrealloc(char *, int);
+extern char *mymalloc(ssize_t);
+extern char *myrealloc(char *, ssize_t);
 extern void myfree(char *);
 extern char *mystrdup(const char *);
-extern char *mystrndup(const char *, int len);
-extern char *mymemdup(const char *, int);
+extern char *mystrndup(const char *, ssize_t);
+extern char *mymemdup(const char *, ssize_t);
 
 /* LICENSE
 /* .ad
index 7607a6b352e713cc58b65499e37125bf23315453..a87a58cba97f77805cd871604bb77220d115730b 100644 (file)
@@ -87,6 +87,7 @@ int     main(void)
        vstream_fflush(VSTREAM_OUT);
     }
     vstring_free(vp);
+    return (0);
 }
 
 #endif
index cd73a53106b20c9b856df9968f99e433b1eced1d..3ce83ffc4021c12fb58a62412eb8eb30b3c3c0bc 100644 (file)
@@ -195,7 +195,7 @@ const char *str_name_mask_opt(const char *context, NAME_MASK *table,
  /*
   * Stand-alone test program.
   */
-
+#include <stdlib.h>
 #include <vstream.h>
 
 int     main(int argc, char **argv)
index 4acea4fa57cbbedeab4fd8437b7e9eba358d7825..82b54941c358df35e89c5f1f99ec21ee6cf5e622 100644 (file)
 /*     VSTRING *netstring_get(stream, buf, limit)
 /*     VSTREAM *stream;
 /*     VSTRING *buf;
-/*     int     limit;
+/*     ssize_t limit;
 /*
 /*     void    netstring_put(stream, data, len)
 /*     VSTREAM *stream;
 /*     const char *data;
-/*     int     len;
+/*     int     ssize_t;
 /*
 /*     void    netstring_put_multi(stream, data, len, data, len, ..., 0)
 /*     VSTREAM *stream;
 /*     const char *data;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     void    NETSTRING_PUT_BUF(stream, buf)
 /*     VSTREAM *stream;
 /*     VSTRING *netstring_memcpy(buf, data, len)
 /*     VSTRING *buf;
 /*     const char *data;
-/*     int     len;
+/*     int     ssize_t;
 /*
 /*     VSTRING *netstring_memcat(buf, data, len)
 /*     VSTRING *buf;
 /*     const char *src;
-/*     int len;
+/*     ssize_t len;
 /* AUXILIARY ROUTINES
-/*     int     netstring_get_length(stream)
+/*     ssize_t netstring_get_length(stream)
 /*     VSTREAM *stream;
 /*
 /*     VSTRING *netstring_get_data(stream, buf, len)
 /*     VSTREAM *stream;
 /*     VSTRING *buf;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     void    netstring_get_terminator(stream)
 /*     VSTREAM *stream;
@@ -185,10 +185,10 @@ void    netstring_except(VSTREAM *stream, int exception)
 
 /* netstring_get_length - read netstring length + terminator */
 
-int     netstring_get_length(VSTREAM *stream)
+ssize_t netstring_get_length(VSTREAM *stream)
 {
     char   *myname = "netstring_get_length";
-    int     len = 0;
+    ssize_t len = 0;
     int     ch;
 
     for (;;) {
@@ -198,7 +198,7 @@ int     netstring_get_length(VSTREAM *stream)
                             NETSTRING_ERR_TIME : NETSTRING_ERR_EOF);
        case ':':
            if (msg_verbose > 1)
-               msg_info("%s: read netstring length %d", myname, len);
+               msg_info("%s: read netstring length %ld", myname, (long) len);
            return (len);
        default:
            if (!ISDIGIT(ch))
@@ -211,7 +211,7 @@ int     netstring_get_length(VSTREAM *stream)
 
 /* netstring_get_data - read netstring payload + terminator */
 
-VSTRING *netstring_get_data(VSTREAM *stream, VSTRING *buf, int len)
+VSTRING *netstring_get_data(VSTREAM *stream, VSTRING *buf, ssize_t len)
 {
     char   *myname = "netstring_get_data";
 
@@ -229,7 +229,7 @@ VSTRING *netstring_get_data(VSTREAM *stream, VSTRING *buf, int len)
                         NETSTRING_ERR_TIME : NETSTRING_ERR_EOF);
     if (msg_verbose > 1)
        msg_info("%s: read netstring data %.*s",
-                myname, len < 30 ? len : 30, STR(buf));
+                myname, (int) (len < 30 ? len : 30), STR(buf));
     netstring_get_terminator(stream);
 
     /*
@@ -249,9 +249,9 @@ void    netstring_get_terminator(VSTREAM *stream)
 
 /* netstring_get - read string from netstring stream */
 
-VSTRING *netstring_get(VSTREAM *stream, VSTRING *buf, int limit)
+VSTRING *netstring_get(VSTREAM *stream, VSTRING *buf, ssize_t limit)
 {
-    int     len;
+    ssize_t len;
 
     len = netstring_get_length(stream);
     if (limit && len > limit)
@@ -262,14 +262,14 @@ VSTRING *netstring_get(VSTREAM *stream, VSTRING *buf, int limit)
 
 /* netstring_put - send string as netstring */
 
-void    netstring_put(VSTREAM *stream, const char *data, int len)
+void    netstring_put(VSTREAM *stream, const char *data, ssize_t len)
 {
     char   *myname = "netstring_put";
 
     if (msg_verbose > 1)
-       msg_info("%s: write netstring len %d data %.*s",
-                myname, len, len < 30 ? len : 30, data);
-    vstream_fprintf(stream, "%d:", len);
+       msg_info("%s: write netstring len %ld data %.*s",
+                myname, (long) len, (int) (len < 30 ? len : 30), data);
+    vstream_fprintf(stream, "%ld:", (long) len);
     vstream_fwrite(stream, data, len);
     VSTREAM_PUTC(',', stream);
 }
@@ -279,9 +279,9 @@ void    netstring_put(VSTREAM *stream, const char *data, int len)
 void    netstring_put_multi(VSTREAM *stream,...)
 {
     char   *myname = "netstring_put_multi";
-    int     total;
+    ssize_t total;
     char   *data;
-    int     data_len;
+    ssize_t data_len;
     va_list ap;
 
     /*
@@ -289,8 +289,8 @@ void    netstring_put_multi(VSTREAM *stream,...)
      */
     va_start(ap, stream);
     for (total = 0; (data = va_arg(ap, char *)) != 0; total += data_len)
-       if ((data_len = va_arg(ap, int)) < 0)
-           msg_panic("netstring_put_multi: bad data length %d", data_len);
+       if ((data_len = va_arg(ap, ssize_t)) < 0)
+           msg_panic("netstring_put_multi: bad data length %ld", (long) data_len);
     va_end(ap);
 
     /*
@@ -299,19 +299,19 @@ void    netstring_put_multi(VSTREAM *stream,...)
     if (msg_verbose > 1) {
        va_start(ap, stream);
        data = va_arg(ap, char *);
-       data_len = va_arg(ap, int);
-       msg_info("%s: write netstring len %d data %.*s",
-                myname, total, data_len < 30 ? data_len : 30, data);
+       data_len = va_arg(ap, ssize_t);
+       msg_info("%s: write netstring len %ld data %.*s",
+        myname, (long) total, (int) (data_len < 30 ? data_len : 30), data);
        va_end(ap);
     }
-    
+
     /*
      * Send the length, content and terminator.
      */
-    vstream_fprintf(stream, "%d:", total);
+    vstream_fprintf(stream, "%ld:", (long) total);
     va_start(ap, stream);
     while ((data = va_arg(ap, char *)) != 0) {
-       data_len = va_arg(ap, int);
+       data_len = va_arg(ap, ssize_t);
        if (data_len > 0)
            if (vstream_fwrite(stream, data, data_len) != data_len)
                netstring_except(stream, vstream_ftimeout(stream) ?
@@ -332,9 +332,9 @@ void    netstring_fflush(VSTREAM *stream)
 
 /* netstring_memcpy - copy data as in-memory netstring */
 
-VSTRING *netstring_memcpy(VSTRING *buf, const char *src, int len)
+VSTRING *netstring_memcpy(VSTRING *buf, const char *src, ssize_t len)
 {
-    vstring_sprintf(buf, "%d:", len);
+    vstring_sprintf(buf, "%ld:", (long) len);
     vstring_memcat(buf, src, len);
     VSTRING_ADDCH(buf, ',');
     return (buf);
@@ -342,9 +342,9 @@ VSTRING *netstring_memcpy(VSTRING *buf, const char *src, int len)
 
 /* netstring_memcat - append data as in-memory netstring */
 
-VSTRING *netstring_memcat(VSTRING *buf, const char *src, int len)
+VSTRING *netstring_memcat(VSTRING *buf, const char *src, ssize_t len)
 {
-    vstring_sprintf_append(buf, "%d:", len);
+    vstring_sprintf_append(buf, "%ld:", (long) len);
     vstring_memcat(buf, src, len);
     VSTRING_ADDCH(buf, ',');
     return (buf);
index 6b82d90e4e8dae517e60a9af3f0b239df77399ec..e6908792ede01688e7720cc7fd71327310d8742f 100644 (file)
 
 extern void netstring_except(VSTREAM *, int);
 extern void netstring_setup(VSTREAM *, int);
-extern int netstring_get_length(VSTREAM *);
-extern VSTRING *netstring_get_data(VSTREAM *, VSTRING *, int);
+extern ssize_t netstring_get_length(VSTREAM *);
+extern VSTRING *netstring_get_data(VSTREAM *, VSTRING *, ssize_t);
 extern void netstring_get_terminator(VSTREAM *);
-extern VSTRING *netstring_get(VSTREAM *, VSTRING *, int);
-extern void netstring_put(VSTREAM *, const char *, int);
+extern VSTRING *netstring_get(VSTREAM *, VSTRING *, ssize_t);
+extern void netstring_put(VSTREAM *, const char *, ssize_t);
 extern void netstring_put_multi(VSTREAM *,...);
 extern void netstring_fflush(VSTREAM *);
-extern VSTRING *netstring_memcpy(VSTRING *, const char *, int);
-extern VSTRING *netstring_memcat(VSTRING *, const char *, int);
+extern VSTRING *netstring_memcpy(VSTRING *, const char *, ssize_t);
+extern VSTRING *netstring_memcat(VSTRING *, const char *, ssize_t);
 
 #define NETSTRING_PUT_BUF(str, buf) \
        netstring_put((str), vstring_str(buf), VSTRING_LEN(buf))
index 9a9273d5fc5710387e44ab93810f88e7abd6321d..87e852d9be6c1a437977016ccee76ea1b2874a59 100644 (file)
@@ -6,10 +6,10 @@
 /* SYNOPSIS
 /*     #include <open_lock.h>
 /*
-/*     VSTREAM *open_lock(path, int flags, int mode, why)
+/*     VSTREAM *open_lock(path, flags, mode, why)
 /*     const char *path;
 /*     int     flags;
-/*     int     mode;
+/*     mode_t  mode;
 /*     VSTRING *why;
 /* DESCRIPTION
 /*     This module opens or creates the named file and attempts to
@@ -55,7 +55,7 @@
 
 /* open_lock - open file and lock it for exclusive access */
 
-VSTREAM *open_lock(const char *path, int flags, int mode, VSTRING *why)
+VSTREAM *open_lock(const char *path, int flags, mode_t mode, VSTRING *why)
 {
     VSTREAM *fp;
 
index 869233f959c6797155673e1cb45aadf0a0d4ed60..ada9f4d6524291cca1c63d42d279014413172cb6 100644 (file)
@@ -25,7 +25,7 @@
  /*
   * External interface.
   */
-extern VSTREAM *open_lock(const char *, int, int, VSTRING *);
+extern VSTREAM *open_lock(const char *, int, mode_t, VSTRING *);
 
 /* LICENSE
 /* .ad
index 90040ebbf1ce8b21a15c100c5db46680fefd19b3..9e984908a5a59a51ef80b611f899b9e56f8891ac 100644 (file)
@@ -6,7 +6,7 @@
 /* SYNOPSIS
 /*     #include <iostuff.h>
 /*
-/*     int     peekfd(fd)
+/*     ssize_t peekfd(fd)
 /*     int     fd;
 /* DESCRIPTION
 /*     peekfd() attempts to find out how many bytes are available to
 
 /* peekfd - return amount of data ready to read */
 
-int     peekfd(int fd)
+ssize_t peekfd(int fd)
 {
-    int     count;
 
     /*
      * Anticipate a series of system-dependent code fragments.
      */
 #ifdef FIONREAD
+    int     count;
+
     return (ioctl(fd, FIONREAD, (char *) &count) < 0 ? -1 : count);
 #else
 #error "don't know how to look ahead"
 #endif
 }
-
index f3595517f3101f1dedecda1b31dd4d7e50d26317..95bb29bb761cf780a506444c7b4c872bcd9cc217 100644 (file)
@@ -72,7 +72,7 @@ VSTRING *readlline(VSTRING *buf, VSTREAM *fp, int *lineno)
 {
     int     ch;
     int     next;
-    int     start;
+    ssize_t start;
     char   *cp;
 
     VSTRING_RESET(buf);
index c047a5bac546c96981301b82677b4adb188d04df..d64840b114256dfac923bc861d089650e57b20ef 100644 (file)
@@ -9,7 +9,7 @@
 /*     VSTREAM *safe_open(path, flags, mode, st, user, group, why)
 /*     const char *path;
 /*     int     flags;
-/*     int     mode;
+/*     mode_t  mode;
 /*     struct stat *st;
 /*     uid_t   user;
 /*     gid_t   group;
@@ -174,7 +174,7 @@ static VSTREAM *safe_open_exist(const char *path, int flags,
 
 /* safe_open_create - create new file */
 
-static VSTREAM *safe_open_create(const char *path, int flags, int mode,
+static VSTREAM *safe_open_create(const char *path, int flags, mode_t mode,
                    struct stat * st, uid_t user, uid_t group, VSTRING *why)
 {
     VSTREAM *fp;
@@ -222,7 +222,7 @@ static VSTREAM *safe_open_create(const char *path, int flags, int mode,
 
 /* safe_open - safely open or create file */
 
-VSTREAM *safe_open(const char *path, int flags, int mode,
+VSTREAM *safe_open(const char *path, int flags, mode_t mode,
                    struct stat * st, uid_t user, gid_t group, VSTRING *why)
 {
     VSTREAM *fp;
index 7bee82c09625b8b8de19beb664b7b619acbfc519..88b53449942a988967c29c085234f9510ca89d55 100644 (file)
@@ -26,7 +26,7 @@
  /*
   * External interface.
   */
-extern VSTREAM *safe_open(const char *, int, int, struct stat *, uid_t, gid_t, VSTRING *);
+extern VSTREAM *safe_open(const char *, int, mode_t, struct stat *, uid_t, gid_t, VSTRING *);
 
 /* LICENSE
 /* .ad
index ff5f36293a8c6f1309a9868e177c290dd81425c4..9b479ca451e2baefc8048c6216328822306b0ec7 100644 (file)
@@ -29,6 +29,7 @@
 #include <sys/socket.h>
 #include <sys/wait.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <string.h>                    /* bzero() prototype for 44BSD */
 
 /* Utility library. */
@@ -66,7 +67,7 @@ static pid_t fork_and_read_select(const char *what, int delay, int fd)
     }
 }
 
-main(int argc, char **argv)
+int     main(int argc, char **argv)
 {
     int     pair1[2];
     int     pair2[2];
@@ -90,4 +91,5 @@ main(int argc, char **argv)
        msg_fatal("write: %m");
     while (wait((int *) 0) >= 0)
         /* void */ ;
+    return (0);
 }
index c916fb46d868f0e573a7d6a5c14a05d8d3148d95..6f07a22acfc606f6d866aeacf71f249e8d4804f7 100644 (file)
@@ -95,13 +95,14 @@ void    sigdelay(void)
 
 #include <stdio.h>
 #include <unistd.h>
+#include <stdlib.h>
 
 static void gotsig(int sig)
 {
     printf("Got signal %d\n", sig);
 }
 
-int     main(int unused_argc, int unused_argv)
+int     main(int unused_argc, char **unused_argv)
 {
     signal(SIGINT, gotsig);
     signal(SIGQUIT, gotsig);
index ff9a123640a81a2baa4d7197a08fc5992cb0f1ff..5fb30d297ca7708405b35aff5b75f04a307072cf 100644 (file)
 /* .IP "SPAWN_CMD_STDERR (int)"
 /*     Each of these specifies I/O redirection of one of the standard file
 /*     descriptors for the command.
-/* .IP "SPAWN_CMD_UID (int)"
+/* .IP "SPAWN_CMD_UID (uid_t)"
 /*     The user ID to execute the command as. The value -1 is reserved
 /*     and cannot be specified.
-/* .IP "SPAWN_CMD_GID (int)"
+/* .IP "SPAWN_CMD_GID (gid_t)"
 /*     The group ID to execute the command as. The value -1 is reserved
 /*     and cannot be specified.
 /* .IP "SPAWN_CMD_TIME_LIMIT (int)"
index 9698d7a26034d49194cfd83bea5ec792a9762a52..185199c9c77a7b64fd63d2994e765818c437c48a 100644 (file)
@@ -73,6 +73,8 @@ int     stream_recv_fd(int fd)
   * stream_send_fd test program) and copy its content until EOF.
   */
 #include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
 #include <split_at.h>
 #include <listen.h>
 
index 4d05de237d308736ef711be8955e42858f99471d..777f95cc02d50d388871c2a71c54d5bf89513028 100644 (file)
@@ -59,6 +59,7 @@ int     stream_send_fd(int fd, int sendfd)
 #ifdef STREAM_CONNECTIONS
     if (ioctl(fd, I_SENDFD, sendfd) < 0)
        msg_fatal("%s: send file descriptor: %m", myname);
+    return (0);
 #else
     msg_fatal("stream connections are not implemented");
 #endif
@@ -72,6 +73,8 @@ int     stream_send_fd(int fd, int sendfd)
   */
 #include <unistd.h>
 #include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
 #include <split_at.h>
 #include <connect.h>
 
index 1d51f31f488bf70a3f80ad2fdb6c2bf19f43f94d..5c8f82fa4bf60fe9faf9acd150de1599665d7de0 100644 (file)
@@ -3,27 +3,29 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <fcntl.h>
-#include <stropts.h>
-#include "iostuff.h"
 
+#include "iostuff.h"
 #include "msg.h"
 #include "msg_vstream.h"
 #include "listen.h"
 #include "connect.h"
 
+#ifdef SUNOS5
+#include <stropts.h>
+
 #define FIFO   "/tmp/test-fifo"
 
 static const char *progname;
 
-static  print_fstat(int fd)
+static void print_fstat(int fd)
 {
     struct stat st;
 
     if (fstat(fd, &st) < 0)
        msg_fatal("fstat: %m");
     vstream_printf("fd %d\n", fd);
-    vstream_printf("dev        %d\n", st.st_dev);
-    vstream_printf("ino        %d\n", st.st_ino);
+    vstream_printf("dev        %ld\n", (long) st.st_dev);
+    vstream_printf("ino        %ld\n", (long) st.st_ino);
     vstream_fflush(VSTREAM_OUT);
 }
 
@@ -32,7 +34,7 @@ static NORETURN usage(void)
     msg_fatal("usage: %s [-p] [-n count] [-v]", progname);
 }
 
-main(int argc, char **argv)
+int     main(int argc, char **argv)
 {
     int     server_fd;
     int     client_fd;
@@ -99,4 +101,11 @@ main(int argc, char **argv)
     }
     if (close(server_fd) < 0)
        msg_fatal("close server fd");
+    return (0);
+}
+#else
+int     main(int argc, char **argv)
+{
+    return (0);
 }
+#endif
index 9cb57e5135ecbe34f86253f42f26ca78559cc6de..0935a0d4e6d1e7c0244b27ad363678373cc1bc2e 100644 (file)
@@ -9,7 +9,7 @@
 /*     int     stream_trigger(service, buf, len, timeout)
 /*     const char *service;
 /*     const char *buf;
-/*     int     len;
+/*     ssize_t len;
 /*     int     timeout;
 /* DESCRIPTION
 /*     stream_trigger() wakes up the named stream server by making
@@ -86,7 +86,7 @@ static void stream_trigger_event(int event, char *context)
 
 /* stream_trigger - wakeup stream server */
 
-int     stream_trigger(const char *service, const char *buf, int len, int timeout)
+int     stream_trigger(const char *service, const char *buf, ssize_t len, int timeout)
 {
     char   *myname = "stream_trigger";
     struct stream_trigger *sp;
index f2a1bb372fa997eaf7e7d8bf42c05a7508162b47..c2ac9313709b0b635039de502bf13352d28eb35e 100644 (file)
@@ -1242,7 +1242,7 @@ typedef int pid_t;
   * not (Clive Jones). So we'll set the threshold at 2.7.
   */
 #ifndef NORETURN
-#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3
+#if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3
 #define NORETURN       void __attribute__((__noreturn__))
 #endif
 #endif
index ee4e150b1269720e01d498608ea7ecf089fe35fd..3446e4fa6bfc5148fc0923210b5317818ae4623f 100644 (file)
@@ -10,7 +10,7 @@
 /*     int     timed_connect(fd, buf, buf_len, timeout)
 /*     int     fd;
 /*     struct sockaddr *buf;
-/*     unsigned buf_len;
+/*     int     buf_len;
 /*     int     timeout;
 /* DESCRIPTION
 /*     timed_connect() implement a BSD socket connect() operation that is
index 509004ba3a561ad56ce61c66bfb447be6d0ab565..51f1cc6f945498b7fa4cf71e51b0c25182c8c732 100644 (file)
@@ -6,10 +6,10 @@
 /* SYNOPSIS
 /*     #include <iostuff.h>
 /*
-/*     int     timed_read(fd, buf, buf_len, timeout, context)
+/*     ssize_t timed_read(fd, buf, len, timeout, context)
 /*     int     fd;
 /*     void    *buf;
-/*     unsigned len;
+/*     size_t  len;
 /*     int     timeout;
 /*     void    *context;
 /* DESCRIPTION
@@ -21,7 +21,7 @@
 /*     File descriptor in the range 0..FD_SETSIZE.
 /* .IP buf
 /*     Read buffer pointer.
-/* .IP buf_len
+/* .IP len
 /*     Read buffer size.
 /* .IP timeout
 /*     The deadline in seconds. If this is <= 0, the deadline feature
 
 /* timed_read - read with deadline */
 
-int     timed_read(int fd, void *buf, unsigned len,
+ssize_t timed_read(int fd, void *buf, size_t len,
                           int timeout, void *unused_context)
 {
-    int     ret;
+    ssize_t ret;
 
     /*
      * Wait for a limited amount of time for something to happen. If nothing
index 3089a83903205b8aa828e6a69775fb10b3045951..d6cf9da5977f2de7a8274eab23500b0334a4ddae 100644 (file)
@@ -6,10 +6,10 @@
 /* SYNOPSIS
 /*     #include <iostuff.h>
 /*
-/*     int     timed_write(fd, buf, buf_len, timeout, context)
+/*     ssize_t timed_write(fd, buf, len, timeout, context)
 /*     int     fd;
 /*     const void *buf;
-/*     unsigned len;
+/*     size_t  len;
 /*     int     timeout;
 /*     void    *context;
 /* DESCRIPTION
@@ -21,7 +21,7 @@
 /*     File descriptor in the range 0..FD_SETSIZE.
 /* .IP buf
 /*     Write buffer pointer.
-/* .IP buf_len
+/* .IP len
 /*     Write buffer size.
 /* .IP timeout
 /*     The deadline in seconds. If this is <= 0, the deadline feature
 
 /* timed_write - write with deadline */
 
-int     timed_write(int fd, void *buf, unsigned len,
+ssize_t timed_write(int fd, void *buf, size_t len,
                            int timeout, void *unused_context)
 {
-    int     ret;
+    ssize_t ret;
 
     /*
      * Wait for a limited amount of time for something to happen. If nothing
index ffcf63c5272df502d8c8e633a166de4d00b6581e..1f15482298f7002d19df55214a4ee13f1d691788 100644 (file)
  /*
   * External interface.
   */
-extern int unix_trigger(const char *, const char *, int, int);
-extern int inet_trigger(const char *, const char *, int, int);
-extern int fifo_trigger(const char *, const char *, int, int);
-extern int stream_trigger(const char *, const char *, int, int);
+extern int unix_trigger(const char *, const char *, ssize_t, int);
+extern int inet_trigger(const char *, const char *, ssize_t, int);
+extern int fifo_trigger(const char *, const char *, ssize_t, int);
+extern int stream_trigger(const char *, const char *, ssize_t, int);
 
 /* LICENSE
 /* .ad
index b8dc3ca806c223f464ffa3ef019d9b0d51ec1584..ef76d6d6444349beab14a685b0d56f9cc0cbf367 100644 (file)
@@ -123,6 +123,7 @@ VSTRING *unescape(VSTRING *result, const char *data)
 
 #ifdef TEST
 
+#include <stdlib.h>
 #include <vstring_vstream.h>
 
 int     main(int unused_argc, char **unused_argv)
index 6a3b1916073b3b862a6a3b3525d18b80e2c60cde..9c4cb8b657e2ac201a6921fd8c9816637eb81f77 100644 (file)
@@ -9,7 +9,7 @@
 /*     int     unix_trigger(service, buf, len, timeout)
 /*     const char *service;
 /*     const char *buf;
-/*     int     len;
+/*     ssize_t len;
 /*     int     timeout;
 /* DESCRIPTION
 /*     unix_trigger() wakes up the named UNIX-domain server by making
@@ -87,7 +87,7 @@ static void unix_trigger_event(int event, char *context)
 
 /* unix_trigger - wakeup UNIX-domain server */
 
-int     unix_trigger(const char *service, const char *buf, int len, int timeout)
+int     unix_trigger(const char *service, const char *buf, ssize_t len, int timeout)
 {
     char   *myname = "unix_trigger";
     struct unix_trigger *up;
index 81019e83b04d3d012513ba87174cae922ce38fab..22eaffbc5f7580f4bf3ba7b4306212b2ae150f51 100644 (file)
 /*
 /*     int     VBUF_SPACE(bp, len)
 /*     VBUF    *bp;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     int     vbuf_unget(bp, ch)
 /*     VBUF    *bp;
 /*     int     ch;
 /*
-/*     int     vbuf_read(bp, buf, len)
+/*     ssize_t vbuf_read(bp, buf, len)
 /*     VBUF    *bp;
 /*     char    *buf;
-/*     int     len;
+/*     ssize_t len;
 /*
-/*     int     vbuf_write(bp, buf, len)
+/*     ssize_t vbuf_write(bp, buf, len)
 /*     VBUF    *bp;
 /*     const char *buf;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     int     vbuf_err(bp)
 /*     VBUF    *bp;
 /*
 /*     int     space(bp, len)
 /*     VBUF    *bp;
-/*     int     len;
+/*     ssize_t len;
 /* APPLICATION CALLBACK DESCRIPTION
 /* .ad
 /* .fi
@@ -166,11 +166,11 @@ int     vbuf_put(VBUF *bp, int ch)
 
 /* vbuf_read - bulk read from buffer */
 
-int     vbuf_read(VBUF *bp, char *buf, int len)
+ssize_t vbuf_read(VBUF *bp, char *buf, ssize_t len)
 {
-    int     count;
+    ssize_t count;
     char   *cp;
-    int     n;
+    ssize_t n;
 
 #if 0
     for (count = 0; count < len; count++)
@@ -192,11 +192,11 @@ int     vbuf_read(VBUF *bp, char *buf, int len)
 
 /* vbuf_write - bulk write to buffer */
 
-int     vbuf_write(VBUF *bp, const char *buf, int len)
+ssize_t vbuf_write(VBUF *bp, const char *buf, ssize_t len)
 {
-    int     count;
+    ssize_t count;
     const char *cp;
-    int     n;
+    ssize_t n;
 
 #if 0
     for (count = 0; count < len; count++)
index 5c50f1a5de781fefe270a04276a6b31e6b4a53fc..d5f4a426c52b4a6ad26a29897e804e40cba3820c 100644 (file)
   *
   * This interface is pretty normal. With one exception: the number of bytes
   * left to read is negated. This is done so that we can change direction
-  * between reading and writing on the fly.
+  * between reading and writing on the fly. The alternative would be to use
+  * separate read and write counters per buffer.
   */
 typedef struct VBUF VBUF;
 typedef int (*VBUF_GET_READY_FN) (VBUF *);
 typedef int (*VBUF_PUT_READY_FN) (VBUF *);
-typedef int (*VBUF_SPACE_FN) (VBUF *, int);
+typedef int (*VBUF_SPACE_FN) (VBUF *, ssize_t);
 
 struct VBUF {
     int     flags;                     /* status, see below */
     unsigned char *data;               /* variable-length buffer */
-    int     len;                       /* buffer length */
-    int     cnt;                       /* bytes left to read/write */
+    ssize_t len;                       /* buffer length */
+    ssize_t cnt;                       /* bytes left to read/write */
     unsigned char *ptr;                        /* read/write position */
     VBUF_GET_READY_FN get_ready;       /* read buffer empty action */
     VBUF_PUT_READY_FN put_ready;       /* write buffer full action */
@@ -83,8 +84,8 @@ struct VBUF {
 extern int vbuf_get(VBUF *);
 extern int vbuf_put(VBUF *, int);
 extern int vbuf_unget(VBUF *, int);
-extern int vbuf_read(VBUF *, char *, int);
-extern int vbuf_write(VBUF *, const char *, int);
+extern ssize_t vbuf_read(VBUF *, char *, ssize_t);
+extern ssize_t vbuf_write(VBUF *, const char *, ssize_t);
 
 /* LICENSE
 /* .ad
index 9b7cb1151420dce85c1885b9011daa1d740d09ee..d395d3176fd38588c97bb6e33ff9ba4bbc0357ad 100644 (file)
@@ -9,7 +9,7 @@
 /*     VSTREAM *vstream_fopen(path, flags, mode)
 /*     char    *path;
 /*     int     flags;
-/*     int     mode;
+/*     mode_t  mode;
 /*
 /*     VSTREAM *vstream_fdopen(fd, flags)
 /*     int     fd;
 /*     int     vstream_fflush(stream)
 /*     VSTREAM *stream;
 /*
-/*     int     vstream_fread(stream, buf, len)
+/*     ssize_t vstream_fread(stream, buf, len)
 /*     VSTREAM *stream;
 /*     char    *buf;
-/*     int     len;
+/*     ssize_t len;
 /*
-/*     int     vstream_fwrite(stream, buf, len)
+/*     ssize_t vstream_fwrite(stream, buf, len)
 /*     VSTREAM *stream;
 /*     char    *buf;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     void    vstream_control(stream, name, ...)
 /*     VSTREAM *stream;
@@ -97,7 +97,7 @@
 /*     char    *format;
 /*     va_list *ap;
 /*
-/*     int     vstream_peek(stream)
+/*     ssize_t vstream_peek(stream)
 /*     VSTREAM *stream;
 /*
 /*     int     vstream_setjmp(stream)
 /*     value) pairs, terminated with VSTREAM_CTL_END.
 /*     The following lists the names and the types of the corresponding
 /*     value arguments.
-/* .IP "VSTREAM_CTL_READ_FN (int (*)(int, void *, unsigned, int, void *))"
+/* .IP "VSTREAM_CTL_READ_FN (ssize_t (*)(int, void *, size_t, int, void *))"
 /*     The argument specifies an alternative for the timed_read(3) function,
 /*     for example, a read function that performs decryption.
-/* .IP "VSTREAM_CTL_WRITE_FN (int (*)(int, void *, unsigned, int, void *))"
+/* .IP "VSTREAM_CTL_WRITE_FN (ssize_t (*)(int, void *, size_t, int, void *))"
 /*     The argument specifies an alternative for the timed_write(3) function,
 /*     for example, a write function that performs encryption.
 /* .IP "VSTREAM_CTL_CONTEXT (char *)"
   */
 static int vstream_buf_get_ready(VBUF *);
 static int vstream_buf_put_ready(VBUF *);
-static int vstream_buf_space(VBUF *, int);
+static int vstream_buf_space(VBUF *, ssize_t);
 
  /*
   * Initialization of the three pre-defined streams. Pre-allocate a static
@@ -459,9 +459,9 @@ static void vstream_buf_init(VBUF *bp, int flags)
 
 /* vstream_buf_alloc - allocate buffer memory */
 
-static void vstream_buf_alloc(VBUF *bp, int len)
+static void vstream_buf_alloc(VBUF *bp, ssize_t len)
 {
-    int     used = bp->ptr - bp->data;
+    ssize_t used = bp->ptr - bp->data;
     char   *myname = "vstream_buf_alloc";
 
     if (len < bp->len)
@@ -494,15 +494,15 @@ static void vstream_buf_wipe(VBUF *bp)
 
 /* vstream_fflush_some - flush some buffered data */
 
-static int vstream_fflush_some(VSTREAM *stream, int to_flush)
+static int vstream_fflush_some(VSTREAM *stream, ssize_t to_flush)
 {
     char   *myname = "vstream_fflush_some";
     VBUF   *bp = &stream->buf;
-    int     used;
-    int     left_over;
+    ssize_t used;
+    ssize_t left_over;
     char   *data;
-    int     len;
-    int     n;
+    ssize_t len;
+    ssize_t n;
 
     /*
      * Sanity checks. It is illegal to flush a read-only stream. Otherwise,
@@ -527,9 +527,9 @@ static int vstream_fflush_some(VSTREAM *stream, int to_flush)
     left_over = used - to_flush;
 
     if (msg_verbose > 2 && stream != VSTREAM_ERR)
-       msg_info("%s: fd %d flush %d", myname, stream->fd, to_flush);
+       msg_info("%s: fd %d flush %ld", myname, stream->fd, (long) to_flush);
     if (to_flush < 0 || left_over < 0)
-       msg_panic("%s: bad to_flush %d", myname, to_flush);
+       msg_panic("%s: bad to_flush %ld", myname, (long) to_flush);
     if (to_flush < left_over)
        msg_panic("%s: to_flush < left_over", myname);
     if (to_flush == 0)
@@ -552,7 +552,8 @@ static int vstream_fflush_some(VSTREAM *stream, int to_flush)
        if (stream->timeout)
            stream->iotime = time((time_t *) 0);
        if (msg_verbose > 2 && stream != VSTREAM_ERR && n != to_flush)
-           msg_info("%s: %d flushed %d/%d", myname, stream->fd, n, to_flush);
+           msg_info("%s: %d flushed %ld/%ld", myname, stream->fd,
+                    (long) n, (long) to_flush);
     }
     if (bp->flags & VSTREAM_FLAG_SEEK)
        stream->offset += to_flush;
@@ -609,7 +610,7 @@ static int vstream_buf_get_ready(VBUF *bp)
 {
     VSTREAM *stream = VBUF_TO_APPL(bp, VSTREAM, buf);
     char   *myname = "vstream_buf_get_ready";
-    int     n;
+    ssize_t n;
 
     /*
      * Detect a change of I/O direction or position. If so, flush any
@@ -687,7 +688,7 @@ static int vstream_buf_get_ready(VBUF *bp)
        if (stream->timeout)
            stream->iotime = time((time_t *) 0);
        if (msg_verbose > 2)
-           msg_info("%s: fd %d got %d", myname, stream->fd, n);
+           msg_info("%s: fd %d got %ld", myname, stream->fd, (long) n);
        bp->cnt = -n;
        bp->ptr = bp->data;
        if (bp->flags & VSTREAM_FLAG_SEEK)
@@ -744,12 +745,12 @@ static int vstream_buf_put_ready(VBUF *bp)
 
 /* vstream_buf_space - reserve space ahead of time */
 
-static int vstream_buf_space(VBUF *bp, int want)
+static int vstream_buf_space(VBUF *bp, ssize_t want)
 {
     VSTREAM *stream = VBUF_TO_APPL(bp, VSTREAM, buf);
-    int     used;
-    int     incr;
-    int     shortage;
+    ssize_t used;
+    ssize_t incr;
+    ssize_t shortage;
     char   *myname = "vstream_buf_space";
 
     /*
@@ -945,7 +946,7 @@ VSTREAM *vstream_fdopen(int fd, int flags)
 
 /* vstream_fopen - open buffered file stream */
 
-VSTREAM *vstream_fopen(const char *path, int flags, int mode)
+VSTREAM *vstream_fopen(const char *path, int flags, mode_t mode)
 {
     VSTREAM *stream;
     int     fd;
@@ -1135,7 +1136,7 @@ VSTREAM *vstream_vfprintf(VSTREAM *vp, const char *format, va_list ap)
 
 /* vstream_peek - peek at a stream */
 
-int     vstream_peek(VSTREAM *vp)
+ssize_t vstream_peek(VSTREAM *vp)
 {
     if (vp->buf.flags & VSTREAM_FLAG_READ) {
        return (-vp->buf.cnt);
index 2e3824a2aef91f4f0631e043fd3b890958362ca4..013dc8e7f640862eda7021ead010aff7a8942cf6 100644 (file)
@@ -29,7 +29,7 @@
   * Simple buffered stream. The members of this structure are not part of the
   * official interface and can change without prior notice.
   */
-typedef int (*VSTREAM_FN) (int, void *, unsigned, int, void *);
+typedef ssize_t(*VSTREAM_FN) (int, void *, size_t, int, void *);
 typedef int (*VSTREAM_WAITPID_FN) (pid_t, WAIT_STATUS_T *, int);
 
 typedef struct VSTREAM {
@@ -71,7 +71,7 @@ extern VSTREAM vstream_fstd[];                /* pre-defined streams */
 
 #define VSTREAM_BUFSIZE                4096
 
-extern VSTREAM *vstream_fopen(const char *, int, int);
+extern VSTREAM *vstream_fopen(const char *, int, mode_t);
 extern int vstream_fclose(VSTREAM *);
 extern off_t vstream_fseek(VSTREAM *, off_t, int);
 extern off_t vstream_ftell(VSTREAM *);
@@ -134,7 +134,7 @@ extern int vstream_pclose(VSTREAM *);
 
 extern VSTREAM *vstream_vfprintf(VSTREAM *, const char *, va_list);
 
-extern int vstream_peek(VSTREAM *);
+extern ssize_t vstream_peek(VSTREAM *);
 
  /*
   * Exception handling. We use pointer to jmp_buf to avoid a lot of unused
index 1b947c49a35ca1fdef396de19c1731b60649b978..e8804d0a110cbae2e05ebf51183321930ee25b6f 100644 (file)
@@ -40,9 +40,9 @@
 /* .IP "VSTREAM_POPEN_EXPORT (char **)"
 /*     Null-terminated array of names of environment parameters
 /*     that can be exported. By default, everything is exported.
-/* .IP "VSTREAM_POPEN_UID (int)"
+/* .IP "VSTREAM_POPEN_UID (uid_t)"
 /*     The user ID to execute the command as. The user ID must be non-zero.
-/* .IP "VSTREAM_POPEN_GID (int)"
+/* .IP "VSTREAM_POPEN_GID (gid_t)"
 /*     The group ID to execute the command as. The group ID must be non-zero.
 /* .IP "VSTREAM_POPEN_SHELL (char *)"
 /*     The shell to use when executing the command specified with
@@ -156,11 +156,11 @@ static void vstream_parse_args(VSTREAM_POPEN_ARGS *args, va_list ap)
            break;
        case VSTREAM_POPEN_UID:
            args->privileged = 1;
-           args->uid = va_arg(ap, int);
+           args->uid = va_arg(ap, uid_t);
            break;
        case VSTREAM_POPEN_GID:
            args->privileged = 1;
-           args->gid = va_arg(ap, int);
+           args->gid = va_arg(ap, gid_t);
            break;
        case VSTREAM_POPEN_ENV:
            args->env = va_arg(ap, char **);
index dacd537e7e46414f924c7c6c5d2a73a73e0aa94d..c4a4a9114775a7de4a99264b465bb2c95af1020e 100644 (file)
@@ -7,7 +7,7 @@
 /*     #include <vstring.h>
 /*
 /*     VSTRING *vstring_alloc(len)
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     vstring_ctl(vp, type, value, ..., VSTRING_CTL_END)
 /*     VSTRING *vp;
@@ -19,7 +19,7 @@
 /*     char    *vstring_str(vp)
 /*     VSTRING *vp;
 /*
-/*     VSTRING *VSTRING_LEN(vp)
+/*     ssize_t VSTRING_LEN(vp)
 /*     VSTRING *vp;
 /*
 /*     char    *vstring_end(vp)
 /*
 /*     int     VSTRING_SPACE(vp, len)
 /*     VSTRING *vp;
-/*     int     len;
+/*     ssize_t len;
 /*
-/*     int     vstring_avail(vp)
+/*     ssize_t vstring_avail(vp)
 /*     VSTRING *vp;
 /*
 /*     VSTRING *vstring_truncate(vp, len)
 /*     VSTRING *vp;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     void    VSTRING_RESET(vp)
 /*     VSTRING *vp;
@@ -56,7 +56,7 @@
 /*     VSTRING *vstring_strncpy(vp, src, len)
 /*     VSTRING *vp;
 /*     const char *src;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     VSTRING *vstring_strcat(vp, src)
 /*     VSTRING *vp;
 /*     VSTRING *vstring_strncat(vp, src, len)
 /*     VSTRING *vp;
 /*     const char *src;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     VSTRING *vstring_memcpy(vp, src, len)
 /*     VSTRING *vp;
 /*     const char *src;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     VSTRING *vstring_memcat(vp, src, len)
 /*     VSTRING *vp;
 /*     const char *src;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     char    *vstring_memchr(vp, ch)
 /*     VSTRING *vp;
@@ -84,7 +84,7 @@
 /*     VSTRING *vstring_prepend(vp, src, len)
 /*     VSTRING *vp;
 /*     const char *src;
-/*     int     len;
+/*     ssize_t len;
 /*
 /*     VSTRING *vstring_sprintf(vp, format, ...)
 /*     VSTRING *vp;
 /*     The function takes a VSTRING pointer and a list of zero
 /*     or more (name,value) pairs. The expected value type
 /*     depends on the specified name. The value name codes are:
-/* .IP "VSTRING_CTL_MAXLEN (int)"
+/* .IP "VSTRING_CTL_MAXLEN (ssize_t)"
 /*     Specifies a hard upper limit on a string's length. When the
 /*     length would be exceeded, the program simulates a memory
 /*     allocation problem (i.e. it terminates through msg_fatal()).
 /*
 /*     vstring_memchr() locates a byte in a variable-length string.
 /*
-/*     vstring_prepend() prepends a buffer content to a variable-length 
+/*     vstring_prepend() prepends a buffer content to a variable-length
 /*     string. The result is null-terminated.
 /*
 /*     vstring_sprintf() produces a formatted string according to its
 
 /* vstring_extend - variable-length string buffer extension policy */
 
-static void vstring_extend(VBUF *bp, int incr)
+static void vstring_extend(VBUF *bp, ssize_t incr)
 {
-    unsigned used = bp->ptr - bp->data;
-    int     new_len;
+    size_t  used = bp->ptr - bp->data;
+    ssize_t new_len;
 
     /*
      * Note: vp->vbuf.len is the current buffer size (both on entry and on
@@ -282,8 +282,13 @@ static void vstring_extend(VBUF *bp, int incr)
      * size to avoid silly little buffer increments. With really large
      * strings we might want to abandon the length doubling strategy, and go
      * to fixed increments.
+     * 
+     * The length overflow tests here and in vstring_alloc() should protect us
+     * against all length overflow problems within vstring library routines.
      */
     new_len = bp->len + (bp->len > incr ? bp->len : incr);
+    if (new_len < 0)
+       msg_fatal("vstring_extend: length overflow");
     bp->data = (unsigned char *) myrealloc((char *) bp->data, new_len);
     bp->len = new_len;
     bp->ptr = bp->data + used;
@@ -307,12 +312,12 @@ static int vstring_buf_put_ready(VBUF *bp)
 
 /* vstring_buf_space - vbuf callback to reserve space */
 
-static int vstring_buf_space(VBUF *bp, int len)
+static int vstring_buf_space(VBUF *bp, ssize_t len)
 {
-    int     need;
+    ssize_t need;
 
     if (len < 0)
-       msg_panic("vstring_buf_space: bad length %d", len);
+       msg_panic("vstring_buf_space: bad length %ld", (long) len);
     if ((need = len - bp->cnt) > 0)
        vstring_extend(bp, need);
     return (0);
@@ -320,12 +325,12 @@ static int vstring_buf_space(VBUF *bp, int len)
 
 /* vstring_alloc - create variable-length string */
 
-VSTRING *vstring_alloc(int len)
+VSTRING *vstring_alloc(ssize_t len)
 {
     VSTRING *vp;
 
     if (len < 1)
-       msg_panic("vstring_alloc: bad length %d", len);
+       msg_panic("vstring_alloc: bad length %ld", (long) len);
     vp = (VSTRING *) mymalloc(sizeof(*vp));
     vp->vbuf.flags = 0;
     vp->vbuf.len = 0;
@@ -363,9 +368,9 @@ void    vstring_ctl(VSTRING *vp,...)
        default:
            msg_panic("vstring_ctl: unknown code: %d", code);
        case VSTRING_CTL_MAXLEN:
-           vp->maxlen = va_arg(ap, int);
+           vp->maxlen = va_arg(ap, ssize_t);
            if (vp->maxlen < 0)
-               msg_panic("vstring_ctl: bad max length %d", vp->maxlen);
+               msg_panic("vstring_ctl: bad max length %ld", (long) vp->maxlen);
            break;
        }
     }
@@ -374,10 +379,10 @@ void    vstring_ctl(VSTRING *vp,...)
 
 /* vstring_truncate - truncate string */
 
-VSTRING *vstring_truncate(VSTRING *vp, int len)
+VSTRING *vstring_truncate(VSTRING *vp, ssize_t len)
 {
     if (len < 0)
-       msg_panic("vstring_truncate: bad length %d", len);
+       msg_panic("vstring_truncate: bad length %ld", (long) len);
     if (len < VSTRING_LEN(vp))
        VSTRING_AT_OFFSET(vp, len);
     return (vp);
@@ -399,7 +404,7 @@ VSTRING *vstring_strcpy(VSTRING *vp, const char *src)
 
 /* vstring_strncpy - copy string of limited length */
 
-VSTRING *vstring_strncpy(VSTRING *vp, const char *src, int len)
+VSTRING *vstring_strncpy(VSTRING *vp, const char *src, ssize_t len)
 {
     VSTRING_RESET(vp);
 
@@ -425,7 +430,7 @@ VSTRING *vstring_strcat(VSTRING *vp, const char *src)
 
 /* vstring_strncat - append string of limited length */
 
-VSTRING *vstring_strncat(VSTRING *vp, const char *src, int len)
+VSTRING *vstring_strncat(VSTRING *vp, const char *src, ssize_t len)
 {
     while (len-- > 0 && *src) {
        VSTRING_ADDCH(vp, *src);
@@ -437,7 +442,7 @@ VSTRING *vstring_strncat(VSTRING *vp, const char *src, int len)
 
 /* vstring_memcpy - copy buffer of limited length */
 
-VSTRING *vstring_memcpy(VSTRING *vp, const char *src, int len)
+VSTRING *vstring_memcpy(VSTRING *vp, const char *src, ssize_t len)
 {
     VSTRING_RESET(vp);
 
@@ -449,7 +454,7 @@ VSTRING *vstring_memcpy(VSTRING *vp, const char *src, int len)
 
 /* vstring_memcat - append buffer of limited length */
 
-VSTRING *vstring_memcat(VSTRING *vp, const char *src, int len)
+VSTRING *vstring_memcat(VSTRING *vp, const char *src, ssize_t len)
 {
     VSTRING_SPACE(vp, len);
     memcpy(vstring_end(vp), src, len);
@@ -472,15 +477,15 @@ char   *vstring_memchr(VSTRING *vp, int ch)
 
 /* vstring_prepend - prepend text to string */
 
-VSTRING *vstring_prepend(VSTRING *vp, const char *buf, int len)
+VSTRING *vstring_prepend(VSTRING *vp, const char *buf, ssize_t len)
 {
-    int     new_len;
+    ssize_t new_len;
 
     /*
      * Sanity check.
      */
     if (len < 0)
-       msg_panic("vstring_prepend: bad length %d", len);
+       msg_panic("vstring_prepend: bad length %ld", (long) len);
 
     /*
      * Move the existing content and copy the new content.
@@ -511,7 +516,7 @@ char   *vstring_export(VSTRING *vp)
 VSTRING *vstring_import(char *str)
 {
     VSTRING *vp;
-    int     len;
+    ssize_t len;
 
     vp = (VSTRING *) mymalloc(sizeof(*vp));
     len = strlen(str);
@@ -567,11 +572,11 @@ VSTRING *vstring_vsprintf_append(VSTRING *vp, const char *format, va_list ap)
 
 /* vstring_sprintf_prepend - format + prepend string, vsprintf-like interface */
 
-VSTRING *vstring_sprintf_prepend(VSTRING *vp, const char *format,  ...)
+VSTRING *vstring_sprintf_prepend(VSTRING *vp, const char *format,...)
 {
     va_list ap;
-    int     old_len = VSTRING_LEN(vp);
-    int     result_len;
+    ssize_t old_len = VSTRING_LEN(vp);
+    ssize_t result_len;
 
     /* Construct: old|new|free */
     va_start(ap, format);
@@ -606,6 +611,7 @@ int     main(int argc, char **argv)
     }
     printf("argv concatenated: %s\n", vstring_str(vp));
     vstring_free(vp);
+    return (0);
 }
 
 #endif
index 0857391260ba0d76154de9e3a170f168222a7845..3c792005ecdfc956ba81632ced933e695d5eef99 100644 (file)
   */
 typedef struct VSTRING {
     VBUF    vbuf;
-    int     maxlen;
+    ssize_t  maxlen;
 } VSTRING;
 
-extern VSTRING *vstring_alloc(int);
+extern VSTRING *vstring_alloc(ssize_t);
 extern void vstring_ctl(VSTRING *,...);
-extern VSTRING *vstring_truncate(VSTRING *, int);
+extern VSTRING *vstring_truncate(VSTRING *, ssize_t);
 extern VSTRING *vstring_free(VSTRING *);
 extern VSTRING *vstring_strcpy(VSTRING *, const char *);
-extern VSTRING *vstring_strncpy(VSTRING *, const char *, int);
+extern VSTRING *vstring_strncpy(VSTRING *, const char *, ssize_t);
 extern VSTRING *vstring_strcat(VSTRING *, const char *);
-extern VSTRING *vstring_strncat(VSTRING *, const char *, int);
-extern VSTRING *vstring_memcpy(VSTRING *, const char *, int);
-extern VSTRING *vstring_memcat(VSTRING *, const char *, int);
+extern VSTRING *vstring_strncat(VSTRING *, const char *, ssize_t);
+extern VSTRING *vstring_memcpy(VSTRING *, const char *, ssize_t);
+extern VSTRING *vstring_memcat(VSTRING *, const char *, ssize_t);
 extern char *vstring_memchr(VSTRING *, int);
-extern VSTRING *vstring_prepend(VSTRING *, const char *, int);
+extern VSTRING *vstring_prepend(VSTRING *, const char *, ssize_t);
 extern VSTRING *PRINTFLIKE(2, 3) vstring_sprintf(VSTRING *, const char *,...);
 extern VSTRING *PRINTFLIKE(2, 3) vstring_sprintf_append(VSTRING *, const char *,...);
 extern VSTRING *PRINTFLIKE(2, 3) vstring_sprintf_prepend(VSTRING *, const char *, ...);
@@ -56,7 +56,7 @@ extern VSTRING *vstring_import(char *);
   */
 #define VSTRING_SPACE(vp, len) ((vp)->vbuf.space(&(vp)->vbuf, len))
 #define vstring_str(vp)                ((char *) (vp)->vbuf.data)
-#define VSTRING_LEN(vp)                ((vp)->vbuf.ptr - (vp)->vbuf.data)
+#define VSTRING_LEN(vp)                ((ssize_t) ((vp)->vbuf.ptr - (vp)->vbuf.data))
 #define vstring_end(vp)                ((char *) (vp)->vbuf.ptr)
 #define VSTRING_TERMINATE(vp)  { if ((vp)->vbuf.cnt <= 0) \
                                        VSTRING_SPACE((vp),1); \
index e19fd382255877ce43a2c64c466f4001c9a93526..7c78427330f84307fa3bc76439222e9654013412 100644 (file)
@@ -196,6 +196,7 @@ int     main(void)
     vstream_fclose(fp);
     vstream_fflush(VSTREAM_OUT);
     vstring_free(vp);
+    return (0);
 }
 
 #endif
index 1c0c088cc7263ae9b410d540b8e3847111d69134..9b4f5ebfa5a9c0e5c071eaeed3c48deb5984596a 100644 (file)
@@ -245,6 +245,7 @@ int     main(int unused_argc, char **unused_argv)
        watchdog_pat();
     } while (VSTREAM_GETCHAR() != VSTREAM_EOF);
     watchdog_destroy(wp);
+    return (0);
 }
 
 #endif
index c6b0ad792b3326508fd87d9545a8097f76862f99..2bce6c972716e69ef8fff1d1b5df40512e43318d 100644 (file)
@@ -6,10 +6,10 @@
 /* SYNOPSIS
 /*     #include <iostuff.h>
 /*
-/*     int     write_buf(fd, buf, len, timeout)
+/*     ssize_t write_buf(fd, buf, len, timeout)
 /*     int     fd;
 /*     const char *buf;
-/*     int     len;
+/*     ssize_t len;
 /*     int     timeout;
 /* DESCRIPTION
 /*     write_buf() writes a buffer to the named stream in as many
@@ -54,9 +54,9 @@
 
 /* write_buf - write buffer or bust */
 
-int     write_buf(int fd, const char *buf, int len, int timeout)
+ssize_t write_buf(int fd, const char *buf, ssize_t len, int timeout)
 {
-    int     count;
+    ssize_t count;
 
     while (len > 0) {
        if (timeout > 0 && write_wait(fd, timeout) < 0)
index 6a61ad99bf8fa1a85cb3ab01dae6797035632e87..0ae579b973f3cc5be36b127e3f6a0277bd8df6c7 100644 (file)
@@ -370,7 +370,6 @@ static void verify_query_service(VSTREAM *client_stream)
     long    probed;
     long    updated;
     char   *text;
-    VSTREAM *post;
 
     if (attr_scan(client_stream, ATTR_FLAG_STRICT,
                  ATTR_TYPE_STR, MAIL_ATTR_ADDR, addr,