From d43277c534904dc31d14bfb0dc934f3cfbe2dab5 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Wed, 1 Jul 2009 18:24:44 +0000 Subject: Fix missing strnlen problems Fix missing strnlen (a GNU extension) problems by using qemu_strnlen used for user emulators also for system emulators. Signed-off-by: Blue Swirl --- cutils.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cutils.c') diff --git a/cutils.c b/cutils.c index 73d4e1fbbd..6196a9055c 100644 --- a/cutils.c +++ b/cutils.c @@ -109,6 +109,19 @@ int stristart(const char *str, const char *val, const char **ptr) return 1; } +/* XXX: use host strnlen if available ? */ +int qemu_strnlen(const char *s, int max_len) +{ + int i; + + for(i = 0; i < max_len; i++) { + if (s[i] == '\0') { + break; + } + } + return i; +} + time_t mktimegm(struct tm *tm) { time_t t; -- cgit 1.4.1