opkg

statically linked package installer
git clone anongit@rnpnr.xyz:opkg.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

0017-Add-standalone-freezero.patch (1725B)


      1 From 98a3b77cfa775c87010159d49f5b17d84fe1aa7b Mon Sep 17 00:00:00 2001
      2 From: Michael Forney <mforney@mforney.org>
      3 Date: Tue, 10 Oct 2017 03:07:56 -0700
      4 Subject: [PATCH] Add standalone freezero
      5 
      6 ---
      7  lib/libc/stdlib/freezero.c | 32 ++++++++++++++++++++++++++++++++
      8  1 file changed, 32 insertions(+)
      9  create mode 100644 lib/libc/stdlib/freezero.c
     10 
     11 diff --git a/lib/libc/stdlib/freezero.c b/lib/libc/stdlib/freezero.c
     12 new file mode 100644
     13 index 00000000000..31face3828b
     14 --- /dev/null
     15 +++ b/lib/libc/stdlib/freezero.c
     16 @@ -0,0 +1,32 @@
     17 +/*
     18 + * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net>
     19 + * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
     20 + * Copyright (c) 2008 Damien Miller <djm@openbsd.org>
     21 + * Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
     22 + *
     23 + * Permission to use, copy, modify, and distribute this software for any
     24 + * purpose with or without fee is hereby granted, provided that the above
     25 + * copyright notice and this permission notice appear in all copies.
     26 + *
     27 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     28 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     29 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     30 + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     31 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     32 + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     33 + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     34 + */
     35 +
     36 +#include <string.h>
     37 +#include <stdlib.h>
     38 +
     39 +void
     40 +freezero(void *ptr, size_t sz)
     41 +{
     42 +	/* This is legal. */
     43 +	if (ptr == NULL)
     44 +		return;
     45 +
     46 +	explicit_bzero(ptr, sz);
     47 +	free(ptr);
     48 +}
     49 -- 
     50 2.14.2
     51