diff options
author | Carmelo Amoroso <carmelo.amoroso@st.com> | 2010-11-28 21:09:47 +0100 |
---|---|---|
committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2010-11-28 21:09:47 +0100 |
commit | 57f6cce72c889f2e7b342e87a565a064320a6ee2 (patch) | |
tree | 5466406472918d3adb63398f5fb9ea1511a5e73f /libc/misc | |
parent | 4ec89b87bc0eea8d9ca6b50564d12eeb3b1b0119 (diff) | |
parent | 5dea871ac73ef4608022c058b50adc946917f9b9 (diff) |
Merge commit 'origin/master' into prelink
Conflicts:
ldso/include/dl-hash.h
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libc/misc')
-rw-r--r-- | libc/misc/internals/parse_config.c | 19 | ||||
-rw-r--r-- | libc/misc/utmp/utxent.c | 6 | ||||
-rw-r--r-- | libc/misc/wchar/wchar.c | 2 |
3 files changed, 18 insertions, 9 deletions
diff --git a/libc/misc/internals/parse_config.c b/libc/misc/internals/parse_config.c index 8fa324e10..c17d25553 100644 --- a/libc/misc/internals/parse_config.c +++ b/libc/misc/internals/parse_config.c @@ -78,6 +78,14 @@ static off_t bb_get_chunk_with_continuation(parser_t* parsr) parsr->line_len += PAGE_SIZE; parsr->data = realloc(parsr->data, parsr->data_len + parsr->line_len); + parsr->line = parsr->data + parsr->data_len; + } else { + /* discard rest of line if not enough space in buffer */ + int c; + do { + c = fgetc(parsr->fp); + } while (c != EOF && c != '\n'); + break; } } return pos; @@ -186,23 +194,20 @@ again: parser->line_len = 81; if (parser->data_len == 0) parser->data_len += 1 + ntokens * sizeof(char *); - parser->data = realloc(parser->data, - parser->data_len + parser->line_len); + parser->data = malloc(parser->data_len + parser->line_len); if (parser->data == NULL) return 0; parser->allocated |= 1; } /* else { assert(parser->data_len > 0); } */ - if (parser->line == NULL) - parser->line = parser->data + parser->data_len; - if (*tokens == NULL) - *tokens = (char **) parser->data; - memset(*tokens, 0, sizeof(*tokens[0]) * ntokens); + parser->line = parser->data + parser->data_len; /*config_free_data(parser);*/ /* Read one line (handling continuations with backslash) */ len = bb_get_chunk_with_continuation(parser); if (len == -1) return 0; + *tokens = (char **) parser->data; + memset(*tokens, 0, sizeof(*tokens[0]) * ntokens); line = parser->line; /* Skip multiple token-delimiters in the start of line? */ diff --git a/libc/misc/utmp/utxent.c b/libc/misc/utmp/utxent.c index 3c59f1c48..a0e80a662 100644 --- a/libc/misc/utmp/utxent.c +++ b/libc/misc/utmp/utxent.c @@ -71,7 +71,8 @@ void getutmp (const struct utmpx *utmpx, struct utmp *utmp) memcpy (utmp->ut_host, utmpx->ut_host, sizeof (utmp->ut_host)); #endif #if _HAVE_UT_TV - 0 - utmp->ut_tv = utmpx->ut_tv; + utmp->ut_tv.tv_sec = utmpx->ut_tv.tv_sec; + utmp->ut_tv.tv_usec = utmpx->ut_tv.tv_usec; #else utmp->ut_time = utmpx->ut_time; #endif @@ -97,7 +98,8 @@ void getutmpx (const struct utmp *utmp, struct utmpx *utmpx) memcpy (utmpx->ut_host, utmp->ut_host, sizeof (utmp->ut_host)); #endif #if _HAVE_UT_TV - 0 - utmpx->ut_tv = utmp->ut_tv; + utmpx->ut_tv.tv_sec = utmp->ut_tv.tv_sec; + utmpx->ut_tv.tv_usec = utmp->ut_tv.tv_usec; #else utmpx->ut_time = utmp->ut_time; #endif diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 7380ac9ae..ab6c617ed 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -286,6 +286,8 @@ size_t mbrtowc(wchar_t *__restrict pwc, const char *__restrict s, s = empty_string; n = 1; } else if (*s == '\0') { + if (pwc) + *pwc = '\0'; /* According to the ISO C 89 standard this is the expected behaviour. */ return 0; } else if (!n) { |