Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen HACK: if calling dirname() with the results o...
details: https://anonhg.NetBSD.org/src/rev/a3b0a824c952
branches: trunk
changeset: 433672:a3b0a824c952
user: kre <kre%NetBSD.org@localhost>
date: Thu Sep 27 00:45:34 2018 +0000
description:
HACK: if calling dirname() with the results of a previous dirname()
there is no need to copy the path into the output buffer, it is already
there....
All this has to change to become compat with a forthcoming POSIX update.
diffstat:
lib/libc/gen/dirname.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (28 lines):
diff -r 902958bac9da -r a3b0a824c952 lib/libc/gen/dirname.c
--- a/lib/libc/gen/dirname.c Wed Sep 26 22:33:35 2018 +0000
+++ b/lib/libc/gen/dirname.c Thu Sep 27 00:45:34 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dirname.c,v 1.13 2014/07/16 10:52:26 christos Exp $ */
+/* $NetBSD: dirname.c,v 1.14 2018/09/27 00:45:34 kre Exp $ */
/*-
* Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: dirname.c,v 1.13 2014/07/16 10:52:26 christos Exp $");
+__RCSID("$NetBSD: dirname.c,v 1.14 2018/09/27 00:45:34 kre Exp $");
#endif /* !LIBC_SCCS && !lint */
#include "namespace.h"
@@ -83,7 +83,8 @@
out:
if (buf != NULL && buflen != 0) {
buflen = MIN(len, buflen - 1);
- memcpy(buf, path, buflen);
+ if (buf != path)
+ memcpy(buf, path, buflen);
buf[buflen] = '\0';
}
return len;
Home |
Main Index |
Thread Index |
Old Index