mirror of
https://github.com/sheumann/hush.git
synced 2024-08-20 04:28:57 +00:00
Patch from Denis Vlasenko to constify things and fix a few typos.
This commit is contained in:
parent
fb16d5c6aa
commit
0a7c8ef6e2
@ -552,9 +552,12 @@ static void free_package(common_node_t *node)
|
|||||||
|
|
||||||
static unsigned int fill_package_struct(char *control_buffer)
|
static unsigned int fill_package_struct(char *control_buffer)
|
||||||
{
|
{
|
||||||
|
static const char *const field_names[] = { "Package", "Version",
|
||||||
|
"Pre-Depends", "Depends","Replaces", "Provides",
|
||||||
|
"Conflicts", "Suggests", "Recommends", "Enhances", 0
|
||||||
|
};
|
||||||
|
|
||||||
common_node_t *new_node = (common_node_t *) xcalloc(1, sizeof(common_node_t));
|
common_node_t *new_node = (common_node_t *) xcalloc(1, sizeof(common_node_t));
|
||||||
const char *field_names[] = { "Package", "Version", "Pre-Depends", "Depends",
|
|
||||||
"Replaces", "Provides", "Conflicts", "Suggests", "Recommends", "Enhances", 0};
|
|
||||||
char *field_name;
|
char *field_name;
|
||||||
char *field_value;
|
char *field_value;
|
||||||
int field_start = 0;
|
int field_start = 0;
|
||||||
|
@ -220,7 +220,7 @@ extern int unzip_main(int argc, char **argv)
|
|||||||
overwrite = (overwrite == o_prompt) ? o_never : overwrite;
|
overwrite = (overwrite == o_prompt) ? o_never : overwrite;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
char *extn[] = {"", ".zip", ".ZIP"};
|
static const char *const extn[] = {"", ".zip", ".ZIP"};
|
||||||
int orig_src_fn_len = strlen(src_fn);
|
int orig_src_fn_len = strlen(src_fn);
|
||||||
for(i = 0; (i < 3) && (src_fd == -1); i++) {
|
for(i = 0; (i < 3) && (src_fd == -1); i++) {
|
||||||
strcpy(src_fn + orig_src_fn_len, extn[i]);
|
strcpy(src_fn + orig_src_fn_len, extn[i]);
|
||||||
|
@ -59,8 +59,9 @@ static const struct option env_long_options[] = {
|
|||||||
|
|
||||||
extern int env_main(int argc, char** argv)
|
extern int env_main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
static char *cleanenv[1] = { NULL };
|
||||||
|
|
||||||
char **ep, *p;
|
char **ep, *p;
|
||||||
char *cleanenv[1] = { NULL };
|
|
||||||
unsigned long opt;
|
unsigned long opt;
|
||||||
llist_t *unset_env = NULL;
|
llist_t *unset_env = NULL;
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
@ -120,12 +120,11 @@ static char const *human_fstype(long f_type)
|
|||||||
{ 0x858458f6, "romfs" },
|
{ 0x858458f6, "romfs" },
|
||||||
{ 0x73717368, "squashfs" },
|
{ 0x73717368, "squashfs" },
|
||||||
{ 0x62656572, "sysfs" },
|
{ 0x62656572, "sysfs" },
|
||||||
{ 0, "UNKNOWN" },
|
{ 0, "UNKNOWN" }
|
||||||
{ 0, NULL }
|
|
||||||
};
|
};
|
||||||
for (i=0; humantypes[i].type; ++i)
|
for (i=0; humantypes[i].type; ++i)
|
||||||
if (humantypes[i].type == f_type)
|
if (humantypes[i].type == f_type)
|
||||||
return humantypes[i].fs;
|
break;
|
||||||
return humantypes[i].fs;
|
return humantypes[i].fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,9 +15,11 @@
|
|||||||
|
|
||||||
int halt_main(int argc, char *argv[])
|
int halt_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
static const int magic[] = {RB_HALT_SYSTEM, RB_POWER_OFF, RB_AUTOBOOT};
|
||||||
|
static const int signals[] = {SIGUSR1, SIGUSR2, SIGTERM};
|
||||||
|
|
||||||
char *delay = "hpr";
|
char *delay = "hpr";
|
||||||
int which, flags, magic[] = {RB_HALT_SYSTEM, RB_POWER_OFF, RB_AUTOBOOT},
|
int which, flags, rc = 1;
|
||||||
signals[] = {SIGUSR1, SIGUSR2, SIGTERM}, rc = 1;
|
|
||||||
|
|
||||||
/* Figure out which applet we're running */
|
/* Figure out which applet we're running */
|
||||||
for(which=0;delay[which]!=*bb_applet_name;which++);
|
for(which=0;delay[which]!=*bb_applet_name;which++);
|
||||||
|
@ -606,16 +606,17 @@ static void process_config_line (const char *line, unsigned long *event_mask)
|
|||||||
char name[STRING_LENGTH];
|
char name[STRING_LENGTH];
|
||||||
char * msg="";
|
char * msg="";
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
/* !!!! Only Uppercase Keywords in devsfd.conf */
|
|
||||||
const char *options[] = { "CLEAR_CONFIG", "INCLUDE", "OPTIONAL_INCLUDE", "RESTORE",
|
|
||||||
"PERMISSIONS", "MODLOAD", "EXECUTE", "COPY", "IGNORE",
|
|
||||||
"MKOLDCOMPAT", "MKNEWCOMPAT","RMOLDCOMPAT", "RMNEWCOMPAT", 0 };
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
debug_msg_logger(LOG_INFO, __FUNCTION__);
|
/* !!!! Only Uppercase Keywords in devsfd.conf */
|
||||||
|
static const char *const options[] = {
|
||||||
|
"CLEAR_CONFIG", "INCLUDE", "OPTIONAL_INCLUDE",
|
||||||
|
"RESTORE", "PERMISSIONS", "MODLOAD", "EXECUTE",
|
||||||
|
"COPY", "IGNORE", "MKOLDCOMPAT", "MKNEWCOMPAT",
|
||||||
|
"RMOLDCOMPAT", "RMNEWCOMPAT", 0
|
||||||
|
};
|
||||||
|
|
||||||
|
debug_msg_logger(LOG_INFO, __FUNCTION__);
|
||||||
|
|
||||||
for (count = 0; count < MAX_ARGS; ++count) p[count][0] = '\0';
|
for (count = 0; count < MAX_ARGS; ++count) p[count][0] = '\0';
|
||||||
num_args = sscanf (line, "%s %s %s %s %s %s %s %s %s %s",
|
num_args = sscanf (line, "%s %s %s %s %s %s %s %s %s %s",
|
||||||
@ -678,7 +679,7 @@ static void process_config_line (const char *line, unsigned long *event_mask)
|
|||||||
if ( ( ptr = strchr (p[0], '.') ) == NULL )
|
if ( ( ptr = strchr (p[0], '.') ) == NULL )
|
||||||
{
|
{
|
||||||
msg="UID.GID";
|
msg="UID.GID";
|
||||||
goto process_config_line_err; /*"missing '.' in UID.GID */
|
goto process_config_line_err; /*"missing '.' in UID.GID"*/
|
||||||
}
|
}
|
||||||
|
|
||||||
*ptr++ = '\0';
|
*ptr++ = '\0';
|
||||||
@ -993,17 +994,19 @@ static void action_compat (const struct devfsd_notify_struct *info, unsigned int
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
char rewind_;
|
char rewind_;
|
||||||
/* 1 to 5 "scsi/" , 6 to 9 "ide/host" */
|
/* 1 to 5 "scsi/" , 6 to 9 "ide/host" */
|
||||||
const char *fmt[] = { NULL ,
|
static const char *const fmt[] = {
|
||||||
"sg/c%db%dt%du%d", /* scsi/generic */
|
NULL ,
|
||||||
"sd/c%db%dt%du%d", /* scsi/disc */
|
"sg/c%db%dt%du%d", /* scsi/generic */
|
||||||
"sr/c%db%dt%du%d", /* scsi/cd */
|
"sd/c%db%dt%du%d", /* scsi/disc */
|
||||||
"sd/c%db%dt%du%dp%d", /* scsi/part */
|
"sr/c%db%dt%du%d", /* scsi/cd */
|
||||||
"st/c%db%dt%du%dm%d%c", /* scsi/mt */
|
"sd/c%db%dt%du%dp%d", /* scsi/part */
|
||||||
"ide/hd/c%db%dt%du%d", /* ide/host/disc */
|
"st/c%db%dt%du%dm%d%c", /* scsi/mt */
|
||||||
"ide/cd/c%db%dt%du%d", /* ide/host/cd */
|
"ide/hd/c%db%dt%du%d", /* ide/host/disc */
|
||||||
"ide/hd/c%db%dt%du%dp%d", /* ide/host/part */
|
"ide/cd/c%db%dt%du%d", /* ide/host/cd */
|
||||||
"ide/mt/c%db%dt%du%d%s", /* ide/host/mt */
|
"ide/hd/c%db%dt%du%dp%d", /* ide/host/part */
|
||||||
NULL };
|
"ide/mt/c%db%dt%du%d%s", /* ide/host/mt */
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
/* First construct compatibility name */
|
/* First construct compatibility name */
|
||||||
switch (action)
|
switch (action)
|
||||||
@ -1596,20 +1599,22 @@ const char *get_old_name (const char *devname, unsigned int namelen,
|
|||||||
const char *pty2;
|
const char *pty2;
|
||||||
size_t len;
|
size_t len;
|
||||||
/* 1 to 5 "scsi/" , 6 to 9 "ide/host", 10 sbp/, 11 vcc/, 12 pty/ */
|
/* 1 to 5 "scsi/" , 6 to 9 "ide/host", 10 sbp/, 11 vcc/, 12 pty/ */
|
||||||
const char *fmt[] = { NULL ,
|
static const char *const fmt[] = {
|
||||||
"sg%u", /* scsi/generic */
|
NULL ,
|
||||||
NULL, /* scsi/disc */
|
"sg%u", /* scsi/generic */
|
||||||
"sr%u", /* scsi/cd */
|
NULL, /* scsi/disc */
|
||||||
NULL, /* scsi/part */
|
"sr%u", /* scsi/cd */
|
||||||
"nst%u%c", /* scsi/mt */
|
NULL, /* scsi/part */
|
||||||
"hd%c" , /* ide/host/disc */
|
"nst%u%c", /* scsi/mt */
|
||||||
"hd%c" , /* ide/host/cd */
|
"hd%c" , /* ide/host/disc */
|
||||||
"hd%c%s", /* ide/host/part */
|
"hd%c" , /* ide/host/cd */
|
||||||
"%sht%d", /* ide/host/mt */
|
"hd%c%s", /* ide/host/part */
|
||||||
"sbpcd%u", /* sbp/ */
|
"%sht%d", /* ide/host/mt */
|
||||||
"vcs%s", /* vcc/ */
|
"sbpcd%u", /* sbp/ */
|
||||||
"%cty%c%c", /* pty/ */
|
"vcs%s", /* vcc/ */
|
||||||
NULL };
|
"%cty%c%c", /* pty/ */
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
debug_msg_logger(LOG_INFO, __FUNCTION__);
|
debug_msg_logger(LOG_INFO, __FUNCTION__);
|
||||||
|
|
||||||
|
@ -1305,10 +1305,12 @@ static const char * const BuffType[] = {"unknown", "1Sect", "DualPort", "DualPor
|
|||||||
static void dump_identity (const struct hd_driveid *id)
|
static void dump_identity (const struct hd_driveid *id)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char pmodes[64] = {0,}, dmodes[128]={0,}, umodes[128]={0,};
|
char pmodes[64], dmodes[128], umodes[128];
|
||||||
const unsigned short int *id_regs= (const void*) id;
|
const unsigned short int *id_regs= (const void*) id;
|
||||||
unsigned long capacity;
|
unsigned long capacity;
|
||||||
|
|
||||||
|
pmodes[0] = dmodes[0] = umodes[0] = '\0';
|
||||||
|
|
||||||
printf("\n Model=%.40s, FwRev=%.8s, SerialNo=%.20s\n Config={",
|
printf("\n Model=%.40s, FwRev=%.8s, SerialNo=%.20s\n Config={",
|
||||||
id->model, id->fw_rev, id->serial_no);
|
id->model, id->fw_rev, id->serial_no);
|
||||||
for (i=0; i<=15; i++)
|
for (i=0; i<=15; i++)
|
||||||
|
@ -416,7 +416,8 @@ static void ipaddr_reset_filter(int _oneline)
|
|||||||
|
|
||||||
extern int ipaddr_list_or_flush(int argc, char **argv, int flush)
|
extern int ipaddr_list_or_flush(int argc, char **argv, int flush)
|
||||||
{
|
{
|
||||||
const char *option[] = { "to", "scope", "up", "label", "dev", 0 };
|
static const char *const option[] = { "to", "scope", "up", "label", "dev", 0 };
|
||||||
|
|
||||||
struct nlmsg_list *linfo = NULL;
|
struct nlmsg_list *linfo = NULL;
|
||||||
struct nlmsg_list *ainfo = NULL;
|
struct nlmsg_list *ainfo = NULL;
|
||||||
struct nlmsg_list *l;
|
struct nlmsg_list *l;
|
||||||
@ -499,7 +500,7 @@ extern int ipaddr_list_or_flush(int argc, char **argv, int flush)
|
|||||||
if (filter_dev) {
|
if (filter_dev) {
|
||||||
filter.ifindex = ll_name_to_index(filter_dev);
|
filter.ifindex = ll_name_to_index(filter_dev);
|
||||||
if (filter.ifindex <= 0) {
|
if (filter.ifindex <= 0) {
|
||||||
bb_error_msg("Device \"%s\" does not exist.", filter_dev);
|
bb_error_msg("Device \"%s\" does not exist", filter_dev);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -631,8 +632,11 @@ static int default_scope(inet_prefix *lcl)
|
|||||||
|
|
||||||
static int ipaddr_modify(int cmd, int argc, char **argv)
|
static int ipaddr_modify(int cmd, int argc, char **argv)
|
||||||
{
|
{
|
||||||
const char *option[] = { "peer", "remote", "broadcast", "brd",
|
static const char *const option[] = {
|
||||||
"anycast", "scope", "dev", "label", "local", 0 };
|
"peer", "remote", "broadcast", "brd",
|
||||||
|
"anycast", "scope", "dev", "label", "local", 0
|
||||||
|
};
|
||||||
|
|
||||||
struct rtnl_handle rth;
|
struct rtnl_handle rth;
|
||||||
struct {
|
struct {
|
||||||
struct nlmsghdr n;
|
struct nlmsghdr n;
|
||||||
@ -716,7 +720,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv)
|
|||||||
uint32_t scope = 0;
|
uint32_t scope = 0;
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
if (rtnl_rtscope_a2n(&scope, *argv)) {
|
if (rtnl_rtscope_a2n(&scope, *argv)) {
|
||||||
invarg(*argv, "invalid scope value.");
|
invarg(*argv, "invalid scope value");
|
||||||
}
|
}
|
||||||
req.ifa.ifa_scope = scope;
|
req.ifa.ifa_scope = scope;
|
||||||
scoped = 1;
|
scoped = 1;
|
||||||
@ -749,11 +753,11 @@ static int ipaddr_modify(int cmd, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (d == NULL) {
|
if (d == NULL) {
|
||||||
bb_error_msg("Not enough information: \"dev\" argument is required.");
|
bb_error_msg("Not enough information: \"dev\" argument is required");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (l && matches(d, l) != 0) {
|
if (l && matches(d, l) != 0) {
|
||||||
bb_error_msg_and_die("\"dev\" (%s) must match \"label\" (%s).", d, l);
|
bb_error_msg_and_die("\"dev\" (%s) must match \"label\" (%s)", d, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (peer_len == 0 && local_len && cmd != RTM_DELADDR) {
|
if (peer_len == 0 && local_len && cmd != RTM_DELADDR) {
|
||||||
@ -803,7 +807,10 @@ static int ipaddr_modify(int cmd, int argc, char **argv)
|
|||||||
|
|
||||||
extern int do_ipaddr(int argc, char **argv)
|
extern int do_ipaddr(int argc, char **argv)
|
||||||
{
|
{
|
||||||
const char *commands[] = { "add", "delete", "list", "show", "lst", "flush", 0 };
|
static const char *const commands[] = {
|
||||||
|
"add", "delete", "list", "show", "lst", "flush", 0
|
||||||
|
};
|
||||||
|
|
||||||
int command_num = 2;
|
int command_num = 2;
|
||||||
|
|
||||||
if (*argv) {
|
if (*argv) {
|
||||||
|
@ -46,12 +46,13 @@ void init_header(struct dhcpMessage *packet, char type)
|
|||||||
/* read a packet from socket fd, return -1 on read error, -2 on packet error */
|
/* read a packet from socket fd, return -1 on read error, -2 on packet error */
|
||||||
int get_packet(struct dhcpMessage *packet, int fd)
|
int get_packet(struct dhcpMessage *packet, int fd)
|
||||||
{
|
{
|
||||||
int bytes;
|
static const char broken_vendors[][8] = {
|
||||||
int i;
|
|
||||||
const char broken_vendors[][8] = {
|
|
||||||
"MSFT 98",
|
"MSFT 98",
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int bytes;
|
||||||
|
int i;
|
||||||
char unsigned *vendor;
|
char unsigned *vendor;
|
||||||
|
|
||||||
memset(packet, 0, sizeof(struct dhcpMessage));
|
memset(packet, 0, sizeof(struct dhcpMessage));
|
||||||
|
Loading…
Reference in New Issue
Block a user