From e8879227c840c3cea038d8a0d20d11da5fd4b70b Mon Sep 17 00:00:00 2001 From: gdr-ftp Date: Fri, 10 Apr 1998 21:33:20 +0000 Subject: [PATCH] basename.c: If the argument provided to dirname(3) doesn't have a directory component, return "." instead of "". --- lib/libc/gen/basename.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libc/gen/basename.c b/lib/libc/gen/basename.c index 725002f..ea25330 100644 --- a/lib/libc/gen/basename.c +++ b/lib/libc/gen/basename.c @@ -1,7 +1,7 @@ /* * These routines were written by Devin Reade for GNO v2.0.4. * - * $Id: basename.c,v 1.3 1997/09/21 06:04:59 gdr Exp $ + * $Id: basename.c,v 1.4 1998/04/10 21:33:20 gdr-ftp Exp $ * * This file is formatted for tabs every 8 columns. */ @@ -71,7 +71,8 @@ dirname (const char *path) delim = strchr(dir,':') ? ':' : '/'; p = strrchr(dir,delim); if (p == NULL) { - *dir = '\0'; + *dir = '.'; + *(dir+1) = '\0'; } else { *p = '\0'; }