summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2009-07-01 18:24:44 +0000
committerBlue Swirl <blauwirbel@gmail.com>2009-07-01 18:24:44 +0000
commitd43277c534904dc31d14bfb0dc934f3cfbe2dab5 (patch)
tree272f8131c34141ffc369fbd40e369a02172584e6 /cutils.c
parentFix typo (diff)
downloadqemu-kvm-d43277c534904dc31d14bfb0dc934f3cfbe2dab5.tar.gz
qemu-kvm-d43277c534904dc31d14bfb0dc934f3cfbe2dab5.tar.bz2
qemu-kvm-d43277c534904dc31d14bfb0dc934f3cfbe2dab5.zip
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 <blauwirbel@gmail.com>
Diffstat (limited to 'cutils.c')
-rw-r--r--cutils.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/cutils.c b/cutils.c
index 73d4e1fbb..6196a9055 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;