summaryrefslogtreecommitdiff
path: root/openbsd-compat/dirname.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-06-28 14:48:28 +1000
committerDamien Miller <djm@mindrot.org>2001-06-28 14:48:28 +1000
commit180207ffe1a54bb15d10ce54fdc854b8dcd0511f (patch)
treecb5a7d07cd28ff08c26f163112d33b7ded283ff6 /openbsd-compat/dirname.c
parent315f8b70b0e255fd7c2222794631d233569ce22b (diff)
20010628
- (djm) Sync openbsd-compat with -current libc
Diffstat (limited to 'openbsd-compat/dirname.c')
-rw-r--r--openbsd-compat/dirname.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/openbsd-compat/dirname.c b/openbsd-compat/dirname.c
index c29082673..a76a1dc13 100644
--- a/openbsd-compat/dirname.c
+++ b/openbsd-compat/dirname.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dirname.c,v 1.4 1999/05/30 17:10:30 espie Exp $ */ 1/* $OpenBSD: dirname.c,v 1.5 2001/06/27 00:58:54 lebel Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -31,7 +31,7 @@
31#ifndef HAVE_DIRNAME 31#ifndef HAVE_DIRNAME
32 32
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34static char rcsid[] = "$OpenBSD: dirname.c,v 1.4 1999/05/30 17:10:30 espie Exp $"; 34static char rcsid[] = "$OpenBSD: dirname.c,v 1.5 2001/06/27 00:58:54 lebel Exp $";
35#endif /* LIBC_SCCS and not lint */ 35#endif /* LIBC_SCCS and not lint */
36 36
37#include <errno.h> 37#include <errno.h>
@@ -74,8 +74,7 @@ dirname(path)
74 errno = ENAMETOOLONG; 74 errno = ENAMETOOLONG;
75 return(NULL); 75 return(NULL);
76 } 76 }
77 (void)strncpy(bname, path, endp - path + 1); 77 strlcpy(bname, path, endp - path + 2);
78 bname[endp - path + 1] = '\0';
79 return(bname); 78 return(bname);
80} 79}
81#endif 80#endif