vfs: check userland buffers before reading them.
[haiku.git] / src / system / libroot / posix / string / strcoll.cpp
blob1a477e57f005519bc58848efbeb63efe206f126e
1 /*
2 * Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 * Copyright 2010, Oliver Tappe, zooey@hirschkaefer.de.
4 * All rights reserved. Distributed under the terms of the MIT License.
5 */
7 #include <errno.h>
8 #include <string.h>
10 #include <errno_private.h>
11 #include "LocaleBackend.h"
14 using BPrivate::Libroot::gLocaleBackend;
17 extern "C" int
18 strcoll(const char *a, const char *b)
20 if (gLocaleBackend != NULL) {
21 int result = 0;
22 status_t status = gLocaleBackend->Strcoll(a, b, result);
24 if (status != B_OK)
25 __set_errno(EINVAL);
27 return result;
30 return strcmp(a, b);