summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2022-05-08 13:39:10 -0700
committerRuss Allbery <eagle@eyrie.org>2022-05-08 16:42:47 -0700
commit903ad187b0cbeadb65de93378b46f08efb1a52df (patch)
treea95cc95fb660a39d2623021926323bdc7a9a872e
parent324b6e7910c2aa9d78e6ab49ea56f87d8bb87f43 (diff)
Declare fake_set_passwd argument const
The function makes a copy of its argument, so the argument can be const. Detected by cppcheck.
-rw-r--r--tests/server/acl/fake-getpwnam.c4
-rw-r--r--tests/server/acl/fake-getpwnam.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/tests/server/acl/fake-getpwnam.c b/tests/server/acl/fake-getpwnam.c
index 9a657aa..5a872f9 100644
--- a/tests/server/acl/fake-getpwnam.c
+++ b/tests/server/acl/fake-getpwnam.c
@@ -8,7 +8,7 @@
* we're looking up matches that, we return it; otherwise, we return NULL.
*
* Written by Russ Allbery <eagle@eyrie.org>
- * Copyright 2018 Russ Allbery <eagle@eyrie.org>
+ * Copyright 2018, 2022 Russ Allbery <eagle@eyrie.org>
* Copyright 2014
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -35,7 +35,7 @@ static struct passwd *pwd_info = NULL;
* NULL.
*/
void
-fake_set_passwd(struct passwd *pwd)
+fake_set_passwd(const struct passwd *pwd)
{
struct passwd *new_pwd;
diff --git a/tests/server/acl/fake-getpwnam.h b/tests/server/acl/fake-getpwnam.h
index 9b09bd1..907f7fe 100644
--- a/tests/server/acl/fake-getpwnam.h
+++ b/tests/server/acl/fake-getpwnam.h
@@ -2,6 +2,7 @@
* Testing interface to the fake getpwnam replacement.
*
* Written by Russ Allbery <eagle@eyrie.org>
+ * Copyright 2022 Russ Allbery <eagle@eyrie.org>
* Copyright 2014
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -23,7 +24,7 @@ BEGIN_DECLS
* Sets the struct passwd returned by getpwnam calls. The last struct passed
* to this function will be returned provided the pw_name matches.
*/
-void fake_set_passwd(struct passwd *pwd);
+void fake_set_passwd(const struct passwd *pwd);
/* Frees the memory allocated by fake_set_passwd. */
void fake_free_passwd(void);