On 28/06/17 03:20, Rosen Penev wrote:
> AFAIK Clang and GCC both support it. Any other relevant compilers?
> 
> 

What do *BSD use? dnsmasq supports them? Policy is C89 and always has been.


Cheers,

Simon.


> On Tue, Jun 27, 2017, 15:40 Simon Kelley <si...@thekelleys.org.uk
> <mailto:si...@thekelleys.org.uk>> wrote:
> 
>     Patch applied, with the exception of the gcc-specific __attribute__
>     stuff.
> 
> 
>     Cheers,
> 
>     Simon.
> 
>     On 27/06/17 00:37, Rosen Penev wrote:
>     > ---
>     >  contrib/lease-tools/dhcp_lease_time.c | 8 ++++----
>     >  src/auth.c                            | 6 +++---
>     >  src/cache.c                           | 2 +-
>     >  src/dnsmasq.h                         | 3 +++
>     >  src/lease.c                           | 1 +
>     >  src/option.c                          | 2 +-
>     >  src/tftp.c                            | 2 +-
>     >  src/util.c                            | 8 ++++----
>     >  8 files changed, 18 insertions(+), 14 deletions(-)
>     >
>     > diff --git a/contrib/lease-tools/dhcp_lease_time.c
>     b/contrib/lease-tools/dhcp_lease_time.c
>     > index fc00ff1..f9d7a85 100644
>     > --- a/contrib/lease-tools/dhcp_lease_time.c
>     > +++ b/contrib/lease-tools/dhcp_lease_time.c
>     > @@ -206,13 +206,13 @@ int main(int argc, char **argv)
>     >       {
>     >         unsigned int x;
>     >         if ((x = t/86400))
>     > -         printf("%dd", x);
>     > +         printf("%ud", x);
>     >         if ((x = (t/3600)%24))
>     > -         printf("%dh", x);
>     > +         printf("%uh", x);
>     >         if ((x = (t/60)%60))
>     > -         printf("%dm", x);
>     > +         printf("%um", x);
>     >         if ((x = t%60))
>     > -         printf("%ds", x);
>     > +         printf("%us", x);
>     >       }
>     >        return 0;
>     >      }
>     > diff --git a/src/auth.c b/src/auth.c
>     > index 4489eac..2c24e16 100644
>     > --- a/src/auth.c
>     > +++ b/src/auth.c
>     > @@ -597,12 +597,12 @@ size_t answer_auth(struct dns_header
>     *header, char *limit, size_t qlen, time_t n
>     >             char *p = name;
>     >
>     >             if (subnet->prefixlen >= 24)
>     > -             p += sprintf(p, "%d.", a & 0xff);
>     > +             p += sprintf(p, "%u.", a & 0xff);
>     >             a = a >> 8;
>     >             if (subnet->prefixlen >= 16 )
>     > -             p += sprintf(p, "%d.", a & 0xff);
>     > +             p += sprintf(p, "%u.", a & 0xff);
>     >             a = a >> 8;
>     > -           p += sprintf(p, "%d.in-addr.arpa", a & 0xff);
>     > +           p += sprintf(p, "%u.in-addr.arpa", a & 0xff);
>     >
>     >           }
>     >  #ifdef HAVE_IPV6
>     > diff --git a/src/cache.c b/src/cache.c
>     > index bf585fe..a719d95 100644
>     > --- a/src/cache.c
>     > +++ b/src/cache.c
>     > @@ -1511,7 +1511,7 @@ void dump_cache(time_t now)
>     >           /* ctime includes trailing \n - eat it */
>     >           *(p-1) = 0;
>     >  #endif
>     > -         my_syslog(LOG_INFO, daemon->namebuff);
>     > +         my_syslog(LOG_INFO, "%s", daemon->namebuff);
>     >         }
>     >      }
>     >  }
>     > diff --git a/src/dnsmasq.h b/src/dnsmasq.h
>     > index 84083cc..44e26c7 100644
>     > --- a/src/dnsmasq.h
>     > +++ b/src/dnsmasq.h
>     > @@ -1212,7 +1212,10 @@ int wildcard_matchn(const char* wildcard,
>     const char* match, int num);
>     >  void die(char *message, char *arg1, int exit_code);
>     >  int log_start(struct passwd *ent_pw, int errfd);
>     >  int log_reopen(char *log_file);
>     > +
>     > +__attribute__ ((format (printf, 2, 3)))
>     >  void my_syslog(int priority, const char *format, ...);
>     > +
>     >  void set_log_writer(void);
>     >  void check_log_writer(int force);
>     >  void flush_log(void);
>     > diff --git a/src/lease.c b/src/lease.c
>     > index 634372d..1970ba9 100644
>     > --- a/src/lease.c
>     > +++ b/src/lease.c
>     > @@ -230,6 +230,7 @@ void lease_update_from_configs(void)
>     >        lease_set_hostname(lease, name, 1, get_domain(lease->addr),
>     NULL); /* updates auth flag only */
>     >  }
>     >
>     > +__attribute__ ((format (printf, 2, 3)))
>     >  static void ourprintf(int *errp, char *format, ...)
>     >  {
>     >    va_list ap;
>     > diff --git a/src/option.c b/src/option.c
>     > index 78ad81e..6a14c4d 100644
>     > --- a/src/option.c
>     > +++ b/src/option.c
>     > @@ -882,7 +882,7 @@ static struct server *add_rev4(struct in_addr
>     addr, int msize)
>     >    switch (msize)
>     >      {
>     >      case 32:
>     > -      p += sprintf(p, "%d.", a & 0xff);
>     > +      p += sprintf(p, "%u.", a & 0xff);
>     >        /* fall through */
>     >      case 24:
>     >        p += sprintf(p, "%d.", (a >> 8) & 0xff);
>     > diff --git a/src/tftp.c b/src/tftp.c
>     > index 8b27c7b..131e6de 100644
>     > --- a/src/tftp.c
>     > +++ b/src/tftp.c
>     > @@ -734,7 +734,7 @@ static ssize_t get_block(char *packet, struct
>     tftp_transfer *transfer)
>     >        if (transfer->opt_blocksize)
>     >       {
>     >         p += (sprintf(p, "blksize") + 1);
>     > -       p += (sprintf(p, "%d", transfer->blocksize) + 1);
>     > +       p += (sprintf(p, "%u", transfer->blocksize) + 1);
>     >       }
>     >        if (transfer->opt_transize)
>     >       {
>     > diff --git a/src/util.c b/src/util.c
>     > index 66128a9..bb6dba3 100644
>     > --- a/src/util.c
>     > +++ b/src/util.c
>     > @@ -448,13 +448,13 @@ void prettyprint_time(char *buf, unsigned int t)
>     >      {
>     >        unsigned int x, p = 0;
>     >         if ((x = t/86400))
>     > -     p += sprintf(&buf[p], "%dd", x);
>     > +     p += sprintf(&buf[p], "%ud", x);
>     >         if ((x = (t/3600)%24))
>     > -     p += sprintf(&buf[p], "%dh", x);
>     > +     p += sprintf(&buf[p], "%uh", x);
>     >        if ((x = (t/60)%60))
>     > -     p += sprintf(&buf[p], "%dm", x);
>     > +     p += sprintf(&buf[p], "%um", x);
>     >        if ((x = t%60))
>     > -     p += sprintf(&buf[p], "%ds", x);
>     > +     p += sprintf(&buf[p], "%us", x);
>     >      }
>     >  }
>     >
>     >
> 
> 
>     _______________________________________________
>     Dnsmasq-discuss mailing list
>     Dnsmasq-discuss@lists.thekelleys.org.uk
>     <mailto:Dnsmasq-discuss@lists.thekelleys.org.uk>
>     http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 


_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

Reply via email to