Use 'sizeof(foo)' instead of 'sizeof foo' even where it's not
required. Although style(9) doesn't say anything about it, this seems to be the preferred form. Sponsored by: DARPA, NAI Labs git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@19 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
parent
a980e1d3da
commit
99d01aea5e
|
@ -92,7 +92,7 @@ main(int argc, char *argv[])
|
||||||
pam_start("su", argc ? *argv : "root", &pamc, &pamh);
|
pam_start("su", argc ? *argv : "root", &pamc, &pamh);
|
||||||
|
|
||||||
/* set some items */
|
/* set some items */
|
||||||
gethostname(hostname, sizeof hostname);
|
gethostname(hostname, sizeof(hostname));
|
||||||
check("pam_set_item", pam_set_item(pamh, PAM_RHOST, hostname));
|
check("pam_set_item", pam_set_item(pamh, PAM_RHOST, hostname));
|
||||||
user = getlogin();
|
user = getlogin();
|
||||||
check("pam_set_item", pam_set_item(pamh, PAM_RUSER, user));
|
check("pam_set_item", pam_set_item(pamh, PAM_RUSER, user));
|
||||||
|
|
|
@ -64,7 +64,7 @@ openpam_ttyconv(int n,
|
||||||
data = data;
|
data = data;
|
||||||
if (n <= 0 || n > PAM_MAX_NUM_MSG)
|
if (n <= 0 || n > PAM_MAX_NUM_MSG)
|
||||||
return (PAM_CONV_ERR);
|
return (PAM_CONV_ERR);
|
||||||
if ((*resp = calloc(n, sizeof **resp)) == NULL)
|
if ((*resp = calloc(n, sizeof(**resp))) == NULL)
|
||||||
return (PAM_BUF_ERR);
|
return (PAM_BUF_ERR);
|
||||||
fd = fileno(stdin);
|
fd = fileno(stdin);
|
||||||
for (i = 0; i < n; ++i) {
|
for (i = 0; i < n; ++i) {
|
||||||
|
@ -91,7 +91,7 @@ openpam_ttyconv(int n,
|
||||||
}
|
}
|
||||||
fputs(msg[i]->msg, stderr);
|
fputs(msg[i]->msg, stderr);
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
fgets(buf, sizeof buf, stdin);
|
fgets(buf, sizeof(buf), stdin);
|
||||||
if (msg[i]->msg_style == PAM_PROMPT_ECHO_OFF) {
|
if (msg[i]->msg_style == PAM_PROMPT_ECHO_OFF) {
|
||||||
tattr.c_lflag = lflag;
|
tattr.c_lflag = lflag;
|
||||||
(void)tcsetattr(fd, TCSANOW, &tattr);
|
(void)tcsetattr(fd, TCSANOW, &tattr);
|
||||||
|
|
|
@ -71,7 +71,7 @@ pam_set_data(pam_handle_t *pamh,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dp = malloc(sizeof *dp)) == NULL)
|
if ((dp = malloc(sizeof(*dp))) == NULL)
|
||||||
return (PAM_BUF_ERR);
|
return (PAM_BUF_ERR);
|
||||||
if ((dp->name = strdup(module_data_name)) == NULL) {
|
if ((dp->name = strdup(module_data_name)) == NULL) {
|
||||||
free(data);
|
free(data);
|
||||||
|
|
|
@ -65,7 +65,7 @@ pam_start(const char *service,
|
||||||
struct pam_handle *ph;
|
struct pam_handle *ph;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if ((ph = calloc(1, sizeof *ph)) == NULL)
|
if ((ph = calloc(1, sizeof(*ph))) == NULL)
|
||||||
return (PAM_BUF_ERR);
|
return (PAM_BUF_ERR);
|
||||||
if ((r = pam_set_item(ph, PAM_SERVICE, service)) != PAM_SUCCESS)
|
if ((r = pam_set_item(ph, PAM_SERVICE, service)) != PAM_SUCCESS)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -110,7 +110,7 @@ _pam_add_module(pam_handle_t *pamh,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* fill in configuration data */
|
/* fill in configuration data */
|
||||||
if ((module = malloc(sizeof *module)) == NULL) {
|
if ((module = malloc(sizeof(*module))) == NULL) {
|
||||||
openpam_log(PAM_LOG_ERROR, "malloc(): %m");
|
openpam_log(PAM_LOG_ERROR, "malloc(): %m");
|
||||||
return (PAM_BUF_ERR);
|
return (PAM_BUF_ERR);
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ pam_strerror(pam_handle_t *pamh,
|
||||||
case PAM_DOMAIN_UNKNOWN:
|
case PAM_DOMAIN_UNKNOWN:
|
||||||
return ("unknown authentication domain");
|
return ("unknown authentication domain");
|
||||||
default:
|
default:
|
||||||
snprintf(unknown, sizeof unknown, "#%d", error_number);
|
snprintf(unknown, sizeof(unknown), "#%d", error_number);
|
||||||
return (unknown);
|
return (unknown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue