All of lore.kernel.org
 help / color / mirror / Atom feed
From: yumkam@gmail.com (Yuriy M. Kaminskiy)
To: util-linux@vger.kernel.org
Subject: Re: [PATCH 06/14] newgrp: rename memset_s()
Date: Fri, 26 Feb 2016 15:29:51 +0300	[thread overview]
Message-ID: <m37fhrods0.fsf@gmail.com> (raw)
In-Reply-To: 1456455812-19453-7-git-send-email-sweet_f_a@gmx.de

Ruediger Meier <sweet_f_a@gmx.de> writes:

> From: Ruediger Meier <ruediger.meier@ga-group.nl>
>
> It's already defined in OSX standard c library.

Would not it be better to just use system-provided memset_s instead by
then? (And it is well possible glibc will provide memset_s in future
too).

> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
> ---
>  login-utils/newgrp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/login-utils/newgrp.c b/login-utils/newgrp.c
> index 141b41b..56639d1 100644
> --- a/login-utils/newgrp.c
> +++ b/login-utils/newgrp.c
> @@ -62,7 +62,7 @@ static char *xgetpass(FILE *input, const char *prompt)
>  
>  /* Ensure memory is set to value c without compiler optimization getting
>   * into way that could happen with memset(3). */
> -static int memset_s(void *v, size_t sz, const int c)
> +static int xmemset_s(void *v, size_t sz, const int c)
>  {
>  	volatile unsigned char *p = v;
>  
> @@ -148,7 +148,7 @@ static int allow_setgid(const struct passwd *pe, const struct group *ge)
>  	if (pwd && *pwd && (xpwd = xgetpass(stdin, _("Password: ")))) {
>  		char *cbuf = crypt(xpwd, pwd);
>  
> -		memset_s(xpwd, strlen(xpwd), 0);
> +		xmemset_s(xpwd, strlen(xpwd), 0);
>  		free(xpwd);
>  		if (!cbuf)
>  			warn(_("crypt failed"));


  reply	other threads:[~2016-02-26 12:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26  3:03 [PATCH 00/14] some fixes, cleanup and portability issues Ruediger Meier
2016-02-26  3:03 ` [PATCH 01/14] logger: use SCM_CREDENTIALS on LINUX only Ruediger Meier
2016-02-26  3:03 ` [PATCH 02/14] build-sys: add openat build conditional Ruediger Meier
2016-02-26  3:03 ` [PATCH 03/14] fdisk: fix warning, incompatible pointer types passing 'uint64_t *' Ruediger Meier
2016-02-26  3:03 ` [PATCH 04/14] libsmartcols: fix uninitialized variable Ruediger Meier
2016-02-26  3:03 ` [PATCH 05/14] misc: fix some includes Ruediger Meier
2016-02-26 11:37   ` Ruediger Meier
2016-02-26  3:03 ` [PATCH 06/14] newgrp: rename memset_s() Ruediger Meier
2016-02-26 12:29   ` Yuriy M. Kaminskiy [this message]
2016-02-26 12:47     ` Ruediger Meier
2016-02-26  3:03 ` [PATCH 07/14] build-sys: build_init should check for flock Ruediger Meier
2016-02-26  3:03 ` [PATCH 08/14] login-utils: minor utmp cleanup Ruediger Meier
2016-02-26  3:03 ` [PATCH 09/14] build-sys: disable login-utils if shadow.h or utmp.h is missing Ruediger Meier
2016-02-26  3:08 ` [PATCH 10/14] build-sys: add --disable-ipcrm --disable-ipcs Ruediger Meier
2016-02-26  3:08   ` [PATCH 11/14] build-sys: chrt requires a sched_set* function Ruediger Meier
2016-02-26  3:08   ` [PATCH 12/14] lib: provide mkostemp fallback function Ruediger Meier
2016-02-26 12:51     ` Yuriy M. Kaminskiy
2016-02-26 13:50       ` Ruediger Meier
2016-02-26 14:51       ` [PATCH] Proper fallback for systems that lacks O_CLOEXEC (was: [PATCH 12/14] lib: provide mkostemp fallback function) Yuriy M. Kaminskiy
2016-02-27 19:40         ` Rüdiger Meier
2016-03-07 13:50         ` Karel Zak
2016-02-27 20:02     ` [PATCH v2 12/14] lib: provide fallback if mkostemp(3) missing Ruediger Meier
2016-02-26  3:08   ` [PATCH 13/14] build-sys: remove duplicate cal sources Ruediger Meier
2016-02-26  3:08   ` [PATCH 14/14] lib: include strutils.h for mempcpy() Ruediger Meier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m37fhrods0.fsf@gmail.com \
    --to=yumkam@gmail.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.