mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
sysctl: remove trivial comments. no code changes
This commit is contained in:
parent
cfdb711a18
commit
81944c9e92
@ -70,41 +70,32 @@ int sysctl_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
return retval;
|
return retval;
|
||||||
} /* end sysctl_main() */
|
} /* end sysctl_main() */
|
||||||
|
|
||||||
/*
|
/* Set sysctl's from a conf file. Format example:
|
||||||
* preload the sysctl's from a conf file
|
* # Controls IP packet forwarding
|
||||||
* - we parse the file and then reform it (strip out whitespace)
|
* net.ipv4.ip_forward = 0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int sysctl_preload_file_and_exit(const char *filename)
|
static int sysctl_preload_file_and_exit(const char *filename)
|
||||||
{
|
{
|
||||||
char *token[2];
|
char *token[2];
|
||||||
parser_t *parser;
|
parser_t *parser;
|
||||||
|
|
||||||
parser = config_open(filename);
|
parser = config_open(filename);
|
||||||
while (config_read(parser, token, 2, 2, "# \t=", PARSE_NORMAL)) { // TODO: ';' is comment char too
|
// TODO: ';' is comment char too
|
||||||
// if (!token[1]) {
|
while (config_read(parser, token, 2, 2, "# \t=", PARSE_NORMAL)) {
|
||||||
// bb_error_msg("warning: %s(%d): invalid syntax, continuing",
|
|
||||||
// filename, parser->lineno);
|
|
||||||
// } else {
|
|
||||||
{
|
|
||||||
#if 0
|
#if 0
|
||||||
char *s = xasprintf("%s=%s", token[0], token[1]);
|
char *s = xasprintf("%s=%s", token[0], token[1]);
|
||||||
sysctl_write_setting(s);
|
sysctl_write_setting(s);
|
||||||
free(s);
|
free(s);
|
||||||
#else // PLAY_WITH_FIRE for -4 bytes?
|
#else /* Save ~4 bytes by using parser internals */
|
||||||
sprintf(parser->line, "%s=%s", token[0], token[1]); // must have room by definition
|
sprintf(parser->line, "%s=%s", token[0], token[1]); // must have room by definition
|
||||||
sysctl_write_setting(parser->line);
|
sysctl_write_setting(parser->line);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (ENABLE_FEATURE_CLEAN_UP)
|
if (ENABLE_FEATURE_CLEAN_UP)
|
||||||
config_close(parser);
|
config_close(parser);
|
||||||
return 0;
|
return 0;
|
||||||
} /* end sysctl_preload_file_and_exit() */
|
} /* end sysctl_preload_file_and_exit() */
|
||||||
|
|
||||||
/*
|
|
||||||
* Write a single sysctl setting
|
|
||||||
*/
|
|
||||||
static int sysctl_write_setting(const char *setting)
|
static int sysctl_write_setting(const char *setting)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
@ -162,9 +153,6 @@ static int sysctl_write_setting(const char *setting)
|
|||||||
return retval;
|
return retval;
|
||||||
} /* end sysctl_write_setting() */
|
} /* end sysctl_write_setting() */
|
||||||
|
|
||||||
/*
|
|
||||||
* Read a sysctl setting
|
|
||||||
*/
|
|
||||||
static int sysctl_read_setting(const char *name)
|
static int sysctl_read_setting(const char *name)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
@ -214,12 +202,9 @@ static int sysctl_read_setting(const char *name)
|
|||||||
return retval;
|
return retval;
|
||||||
} /* end sysctl_read_setting() */
|
} /* end sysctl_read_setting() */
|
||||||
|
|
||||||
/*
|
|
||||||
* Display all the sysctl settings
|
|
||||||
*/
|
|
||||||
static int sysctl_display_all(const char *path)
|
static int sysctl_display_all(const char *path)
|
||||||
{
|
{
|
||||||
int retval = 0;
|
int retval = EXIT_SUCCESS;
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
char *tmpdir;
|
char *tmpdir;
|
||||||
|
Loading…
Reference in New Issue
Block a user