added 'const' to function prototype vars where possible

Added the 'const' qualifier to function prototype variables where possible.
In addition, reduced some functions to file-scope with 'static' where possible.

Also made a few minor changes to remove extra whitespace, and fixed a bug
in create_fwknoprc() to ensure the new fwknoprc filehandle is closed.
This commit is contained in:
Michael Rash
2011-10-25 21:00:40 -04:00
parent 85377267e2
commit 6388e8ac7f
48 changed files with 402 additions and 396 deletions

View File

@@ -89,8 +89,8 @@ alarm_handler(int sig)
* Note: XXX: We are not using the timeout parameter at present. We still need
* to implement a reliable timeout mechanism.
*/
int
_run_extcmd(uid_t user_uid, char *cmd, char *so_buf, size_t so_buf_sz, int timeout)
static int
_run_extcmd(uid_t user_uid, const char *cmd, char *so_buf, const size_t so_buf_sz, const int timeout)
{
FILE *ipt;
int retval = 0;
@@ -379,7 +379,7 @@ _run_extcmd(uid_t user_uid, char *cmd, char *so_buf, size_t so_buf_sz, int timeo
/* Run an external command. This is wrapper around _run_extcmd()
*/
int
run_extcmd(char *cmd, char *so_buf, size_t so_buf_sz, int timeout)
run_extcmd(const char *cmd, char *so_buf, const size_t so_buf_sz, const int timeout)
{
return _run_extcmd(0, cmd, so_buf, so_buf_sz, timeout);
}
@@ -387,7 +387,7 @@ run_extcmd(char *cmd, char *so_buf, size_t so_buf_sz, int timeout)
/* Run an external command as the specified user. This is wrapper around _run_extcmd()
*/
int
run_extcmd_as(uid_t user_uid, char *cmd, char *so_buf, size_t so_buf_sz, int timeout)
run_extcmd_as(uid_t user_uid, const char *cmd, char *so_buf, const size_t so_buf_sz, const int timeout)
{
return _run_extcmd(user_uid, cmd, so_buf, so_buf_sz, timeout);
}