Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Make explicit_memset match memset's return value.



details:   https://anonhg.NetBSD.org/src/rev/5b3df55e9c63
branches:  trunk
changeset: 789627:5b3df55e9c63
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Aug 28 15:46:23 2013 +0000

description:
Make explicit_memset match memset's return value.

diffstat:

 common/lib/libc/string/explicit_memset.c |   6 +++---
 include/string.h                         |   4 ++--
 lib/libc/string/explicit_memset.3        |  11 ++++++++---
 3 files changed, 13 insertions(+), 8 deletions(-)

diffs (78 lines):

diff -r 308fe672b9f0 -r 5b3df55e9c63 common/lib/libc/string/explicit_memset.c
--- a/common/lib/libc/string/explicit_memset.c  Wed Aug 28 15:39:30 2013 +0000
+++ b/common/lib/libc/string/explicit_memset.c  Wed Aug 28 15:46:23 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: explicit_memset.c,v 1.1 2013/06/24 04:21:19 riastradh Exp $ */
+/* $NetBSD: explicit_memset.c,v 1.2 2013/08/28 15:46:23 riastradh Exp $ */
 
 #if !defined(_KERNEL) && !defined(_STANDALONE)
 #include <string.h>
@@ -14,9 +14,9 @@
  */
 void *(* volatile explicit_memset_impl)(void *, int, size_t) = memset;
 
-void
+void *
 explicit_memset(void *b, int c, size_t len)
 {
 
-       (*explicit_memset_impl)(b, c, len);
+       return (*explicit_memset_impl)(b, c, len);
 }
diff -r 308fe672b9f0 -r 5b3df55e9c63 include/string.h
--- a/include/string.h  Wed Aug 28 15:39:30 2013 +0000
+++ b/include/string.h  Wed Aug 28 15:46:23 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: string.h,v 1.46 2013/08/27 18:29:28 joerg Exp $        */
+/*     $NetBSD: string.h,v 1.47 2013/08/28 15:46:23 riastradh Exp $    */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -103,7 +103,7 @@
 char   *stresep(char **, const char *, int);
 char   *strndup(const char *, size_t);
 void   *memrchr(const void *, int, size_t);
-void   __explicit_memset(void *, int, size_t);
+void   *__explicit_memset(void *, int, size_t);
 int    __consttime_memequal(const void *, const void *, size_t);
 __END_DECLS
 #endif
diff -r 308fe672b9f0 -r 5b3df55e9c63 lib/libc/string/explicit_memset.3
--- a/lib/libc/string/explicit_memset.3 Wed Aug 28 15:39:30 2013 +0000
+++ b/lib/libc/string/explicit_memset.3 Wed Aug 28 15:46:23 2013 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: explicit_memset.3,v 1.1 2013/06/24 04:21:20 riastradh Exp $
+.\"    $NetBSD: explicit_memset.3,v 1.2 2013/08/28 15:46:23 riastradh Exp $
 .\"
 .\" Copyright (c) 2013 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 23, 2013
+.Dd August 28, 2013
 .Dt EXPLICIT_MEMSET 3
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Lb libc
 .Sh SYNOPSIS
 .In string.h
-.Ft void
+.Ft void *
 .Fn explicit_memset "void *b" "int c" "size_t len"
 .Sh DESCRIPTION
 The
@@ -51,6 +51,11 @@
 It is guaranteed not to be optimized away by the compiler even if
 .Fa b
 is no longer used and is about to be freed or go out of scope.
+.Sh RETURN VALUES
+The
+.Fn explicit_memset
+function returns the original value of
+.Fa b .
 .Sh EXAMPLES
 Create a buffer on the stack for a secret key, use it, and then zero it
 in memory before throwing it away.



Home | Main Index | Thread Index | Old Index