All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
To: keyrings@vger.kernel.org
Cc: "David Howells" <dhowells@redhat.com>,
	"Stephan Müller" <smueller@chronox.de>,
	"Christophe Vu-Brugier" <cvubrugier@fastmail.fm>
Subject: [PATCH 2/4] Fix compilation error when keyutils.h is used in C++
Date: Thu, 02 Jul 2020 08:57:21 +0000	[thread overview]
Message-ID: <20200702085723.7026-3-cvubrugier@fastmail.fm> (raw)
In-Reply-To: <20200702085723.7026-1-cvubrugier@fastmail.fm>

The declaration of the keyctl_dh_compute_kdf() function contains a
parameter named "private". Unfortunately, "private" is a C++ reserved
keyword. As a consequence, compiling a C++ program that includes
keyutils.h fails.

This patch renames the "private" variable to "priv" since a similar
parameter is named this way in the nearby keyctl_dh_compute()
function.

Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
---
 keyutils.c | 4 ++--
 keyutils.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/keyutils.c b/keyutils.c
index 9c37256..9877fdb 100644
--- a/keyutils.c
+++ b/keyutils.c
@@ -244,11 +244,11 @@ long keyctl_dh_compute(key_serial_t priv, key_serial_t prime,
 	return keyctl(KEYCTL_DH_COMPUTE, &params, buffer, buflen, 0);
 }
 
-long keyctl_dh_compute_kdf(key_serial_t private, key_serial_t prime,
+long keyctl_dh_compute_kdf(key_serial_t priv, key_serial_t prime,
 			   key_serial_t base, char *hashname, char *otherinfo,
 			   size_t otherinfolen, char *buffer, size_t buflen)
 {
-	struct keyctl_dh_params params = { .priv = private,
+	struct keyctl_dh_params params = { .priv = priv,
 					   .prime = prime,
 					   .base = base };
 	struct keyctl_kdf_params kdfparams = { .hashname = hashname,
diff --git a/keyutils.h b/keyutils.h
index d50119e..bdecf15 100644
--- a/keyutils.h
+++ b/keyutils.h
@@ -220,7 +220,7 @@ extern long keyctl_invalidate(key_serial_t id);
 extern long keyctl_get_persistent(uid_t uid, key_serial_t id);
 extern long keyctl_dh_compute(key_serial_t priv, key_serial_t prime,
 			      key_serial_t base, char *buffer, size_t buflen);
-extern long keyctl_dh_compute_kdf(key_serial_t private, key_serial_t prime,
+extern long keyctl_dh_compute_kdf(key_serial_t priv, key_serial_t prime,
 				  key_serial_t base, char *hashname,
 				  char *otherinfo, size_t otherinfolen,
 				  char *buffer, size_t buflen);
-- 
2.27.0

  parent reply	other threads:[~2020-07-02  8:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-02  8:57 [PATCH 0/4] keyutils: fix compilation error with C++ Christophe Vu-Brugier
2020-07-02  8:57 ` [PATCH 1/4] man: fix typos Christophe Vu-Brugier
2020-07-02  8:57 ` Christophe Vu-Brugier [this message]
2020-07-02  8:57 ` [PATCH 3/4] Check that keyutils.h has valid C++ syntax at build time Christophe Vu-Brugier
2020-07-02  8:57 ` [PATCH 4/4] Fix error when a C++ program is linked with libkeyutils Christophe Vu-Brugier
2020-07-06 20:27 ` [PATCH 0/4] keyutils: fix compilation error with C++ David Howells

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=20200702085723.7026-3-cvubrugier@fastmail.fm \
    --to=cvubrugier@fastmail.fm \
    --cc=dhowells@redhat.com \
    --cc=keyrings@vger.kernel.org \
    --cc=smueller@chronox.de \
    --subject='Re: [PATCH 2/4] Fix compilation error when keyutils.h is used in C++' \
    /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

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.