vfs: check userland buffers before reading them.
[haiku.git] / src / libs / bsd / progname.c
blob2d68901c70341074e0e512b1dca60a153955274b
1 /*
2 * Copyright 2006, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Axel Dörfler, axeld@pinc-software.de
7 */
10 #include <stdlib.h>
11 #include <string.h>
14 extern const char *__progname;
16 const char *_getprogname(void);
19 const char *
20 _getprogname(void)
22 return __progname;
26 void
27 setprogname(const char *programName)
29 const char *slash = strrchr(programName, '/');
30 if (slash != NULL)
31 __progname = slash + 1;
32 else
33 __progname = programName;
36 #pragma weak getprogname=_getprogname