summaryrefslogtreecommitdiff
path: root/modules/pam_namespace
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2020-03-16 21:02:18 +0000
committerDmitry V. Levin <ldv@altlinux.org>2020-03-19 18:40:16 +0000
commit1181e0590c9f059c40b71718d4fb3b6c339f65db (patch)
tree96da444742d360992e91d6f937e461892ff5f1c0 /modules/pam_namespace
parenta8b4dce7b53d73de372e150028c970ee0a2a2e97 (diff)
Use PAM_ARRAY_SIZE
Replace all instances of sizeof(x) / sizeof(*x) with PAM_ARRAY_SIZE(x) which is less error-prone and implements an additional type check. * libpam/pam_handlers.c: Include "pam_inline.h". (_pam_open_config_file): Use PAM_ARRAY_SIZE. * modules/pam_exec/pam_exec.c: Include "pam_inline.h". (call_exec): Use PAM_ARRAY_SIZE. * modules/pam_namespace/pam_namespace.c: Include "pam_inline.h". (filter_mntopts): Use PAM_ARRAY_SIZE. * modules/pam_timestamp/hmacfile.c: Include "pam_inline.h". (testvectors): Use PAM_ARRAY_SIZE. * modules/pam_xauth/pam_xauth.c: Include "pam_inline.h". (run_coprocess, pam_sm_open_session): Use PAM_ARRAY_SIZE. * tests/tst-pam_get_item.c: Include "pam_inline.h". (main): Use PAM_ARRAY_SIZE. * tests/tst-pam_set_item.c: Likewise. * xtests/tst-pam_pwhistory1.c: Likewise. * xtests/tst-pam_time1.c: Likewise.
Diffstat (limited to 'modules/pam_namespace')
-rw-r--r--modules/pam_namespace/pam_namespace.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/pam_namespace/pam_namespace.c b/modules/pam_namespace/pam_namespace.c
index 155d3965..51f7ac15 100644
--- a/modules/pam_namespace/pam_namespace.c
+++ b/modules/pam_namespace/pam_namespace.c
@@ -35,6 +35,7 @@
#define _ATFILE_SOURCE
#include "pam_cc_compat.h"
+#include "pam_inline.h"
#include "pam_namespace.h"
#include "argv_parse.h"
@@ -260,7 +261,7 @@ static int filter_mntopts(const char *opts, char **filtered,
do {
size_t len;
- int i;
+ unsigned int i;
end = strchr(opts, ',');
if (end == NULL) {
@@ -269,7 +270,7 @@ static int filter_mntopts(const char *opts, char **filtered,
len = end - opts;
}
- for (i = 0; i < (int)(sizeof(mntflags)/sizeof(mntflags[0])); i++) {
+ for (i = 0; i < PAM_ARRAY_SIZE(mntflags); i++) {
if (mntflags[i].len != len)
continue;
if (memcmp(mntflags[i].name, opts, len) == 0) {