diff options
author | Justin Maggard <jmaggard@users.sourceforce.net> | 2011-09-17 03:39:57 +0400 |
---|---|---|
committer | Justin Maggard <jmaggard@users.sourceforce.net> | 2011-09-17 03:39:57 +0400 |
commit | b81ff08b0ce5b99768f04c17002005bad5e20c07 (patch) | |
tree | 4cba796c6de01aeb93251589bfe21fe5288cfcaa /options.c | |
parent | 44f26df01df3ad565be9b9aa7df918f4b2bbeb5e (diff) |
* Add support for other operating systems (kFreeBSD, FreeBSD, and OSX for now).
* Switch to autoconf from genconfig.sh.
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -76,7 +76,7 @@ readoptionsfile(const char * fname) int i; enum upnpconfigoptions id; - if(!fname || (strlen(fname) == 0)) + if(!fname || *fname == '\0') return -1; memset(buffer, 0, sizeof(buffer)); @@ -155,8 +155,17 @@ readoptionsfile(const char * fname) } else { - num_options += 1; - ary_options = (struct option *) realloc(ary_options, num_options * sizeof(struct option)); + num_options++; + t = realloc(ary_options, num_options * sizeof(struct option)); + if(!t) + { + fprintf(stderr, "memory allocation error: %s=%s\n", + name, value); + num_options--; + continue; + } + else + ary_options = (struct option *)t; ary_options[num_options-1].id = id; strncpy(ary_options[num_options-1].value, value, MAX_OPTION_VALUE_LEN); |