~ubuntu-branches/ubuntu/saucy/postfix/saucy

« back to all changes in this revision

Viewing changes to src/global/mail_conf_long.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2011-02-22 11:20:43 UTC
  • mfrom: (1.1.27 upstream)
  • Revision ID: james.westby@ubuntu.com-20110222112043-c34ht219w3ybrilr
Tags: 2.8.0-2
* a little more lintian cleanup
* Fix missing format strings in smtp-sink.c

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
 
80
80
#include <sys_defs.h>
81
81
#include <stdlib.h>
82
 
#include <stdio.h>                      /* sscanf() */
 
82
#include <stdio.h>                      /* BUFSIZ */
 
83
#include <errno.h>
83
84
 
84
85
/* Utility library. */
85
86
 
97
98
static int convert_mail_conf_long(const char *name, long *longval)
98
99
{
99
100
    const char *strval;
100
 
    char    junk;
 
101
    char   *end;
101
102
 
102
103
    if ((strval = mail_conf_lookup_eval(name)) != 0) {
103
 
        if (sscanf(strval, "%ld%c", longval, &junk) != 1)
 
104
        errno = 0;
 
105
        *longval = strtol(strval, &end, 10);
 
106
        if (*strval == 0 || *end != 0 || errno == ERANGE)
104
107
            msg_fatal("bad numerical configuration: %s = %s", name, strval);
105
108
        return (1);
106
109
    }