aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2020-01-17 23:46:42 +0000
committerDmitry V. Levin <ldv@altlinux.org>2020-01-20 12:28:59 +0000
commit98244ec036096c7571d3bc3782baccab4c7565db (patch)
treea865e431999514722799024be58cfdf7666534ab /tests
parentc006f4c5a25c95fd4f39dcb87271825d0c154203 (diff)
downloadpam-98244ec036096c7571d3bc3782baccab4c7565db.tar.gz
pam-98244ec036096c7571d3bc3782baccab4c7565db.tar.bz2
pam-98244ec036096c7571d3bc3782baccab4c7565db.zip
_pam_mkargv: add const qualifier to the first argument
Also fix the following compilation warning: tests/tst-pam_mkargv.c:21:22: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] char *argvstring = "user = XENDT\\userα user=XENDT\\user1"; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * libpam/pam_misc.c (_pam_mkargv): Add const qualifier to the first argument. * libpam/pam_private.h (_pam_mkargv): Likewise. * tests/tst-pam_mkargv.c (main): Convert argvstring from a pointer into a static const string, make argvresult array static const.
Diffstat (limited to 'tests')
-rw-r--r--tests/tst-pam_mkargv.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/tst-pam_mkargv.c b/tests/tst-pam_mkargv.c
index d3e7a616..cb005e5f 100644
--- a/tests/tst-pam_mkargv.c
+++ b/tests/tst-pam_mkargv.c
@@ -18,16 +18,16 @@
/* Simple program to see if _pam_mkargv() would succeed. */
int main(void)
{
- char *argvstring = "user = XENDT\\userα user=XENDT\\user1";
- const char *argvresult[] = {"user", "=", "XENDT\\userα",
- "user=XENDT\\user1"};
+ static const char argvstring[] = "user = XENDT\\userα user=XENDT\\user1";
+ static const char * const argvresult[] = {"user", "=", "XENDT\\userα",
+ "user=XENDT\\user1"};
int myargc;
char **myargv;
int argvlen;
int explen;
int i;
- explen = (strlen(argvstring) + 1) * ((sizeof(char)) + sizeof(char *));
+ explen = sizeof(argvstring) * ((sizeof(char)) + sizeof(char *));
argvlen = _pam_mkargv(argvstring, &myargv, &myargc);
#if 0