Index: basename.c =================================================================== RCS file: /cvsroot/src/lib/libc/gen/basename.c,v retrieving revision 1.8 diff -u -r1.8 basename.c --- basename.c 10 May 2008 22:39:40 -0000 1.8 +++ basename.c 9 Oct 2009 16:42:31 -0000 @@ -47,7 +47,6 @@ char * basename(char *path) { - static char singledot[] = "."; static char result[PATH_MAX]; const char *p, *lastp; size_t len; @@ -56,8 +55,12 @@ * If `path' is a null pointer or points to an empty string, * return a pointer to the string ".". */ - if ((path == NULL) || (*path == '\0')) - return (singledot); + if ((path == NULL) || (*path == '\0')) { + result[0] = '.'; + result[1] = '\0'; + + return (result); + } /* Strip trailing slashes, if any. */ lastp = path + strlen(path) - 1; Index: dirname.c =================================================================== RCS file: /cvsroot/src/lib/libc/gen/dirname.c,v retrieving revision 1.10 diff -u -r1.10 dirname.c --- dirname.c 10 May 2008 22:39:40 -0000 1.10 +++ dirname.c 9 Oct 2009 16:42:31 -0000 @@ -47,7 +47,6 @@ char * dirname(char *path) { - static char singledot[] = "."; static char result[PATH_MAX]; const char *lastp; size_t len; @@ -57,7 +56,8 @@ * return a pointer to the string ".". */ if ((path == NULL) || (*path == '\0')) - return (singledot); + goto singledot; + /* Strip trailing slashes, if any. */ lastp = path + strlen(path) - 1; @@ -84,6 +84,10 @@ } while (--lastp >= path); /* No /'s found, return a pointer to the string ".". */ - return (singledot); +singledot: + result[0] = '.'; + result[1] = '\0'; + + return (result); } #endif