summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1999-07-11 06:02:55 +0000
committerThomas Bushnell <thomas@gnu.org>1999-07-11 06:02:55 +0000
commit4b8c3a57654a54c370e35d30ba43f59309759ea3 (patch)
tree7c042a9a0054bed375fe940e0e96623bef1b3abf
parent251871b4158facbd4c92baf45b0456fdcc82cbb6 (diff)
1999-07-11 Thomas Bushnell, BSG <tb@mit.edu>
* ugids-argp.c (parse_opt): Clarify if-then-else structure by adding more braces. * portinfo.c (print_port_info): Cast first arg of munmap correctly. (print_task_ports_info): Likewise. * xportinfo.c (print_xlated_task_ports_info): Likewise. * idvec-auth.c (idvec_merge_auth): Likewise. * portxlate.c (port_name_xlator_create): Likewise. (port_name_xlator_free): Likewise.
-rw-r--r--libshouldbeinlibc/ChangeLog13
-rw-r--r--libshouldbeinlibc/portinfo.c6
-rw-r--r--libshouldbeinlibc/portxlate.c10
-rw-r--r--libshouldbeinlibc/ugids-argp.c54
-rw-r--r--libshouldbeinlibc/xportinfo.c4
5 files changed, 54 insertions, 33 deletions
diff --git a/libshouldbeinlibc/ChangeLog b/libshouldbeinlibc/ChangeLog
index 207d1017..eee2ec95 100644
--- a/libshouldbeinlibc/ChangeLog
+++ b/libshouldbeinlibc/ChangeLog
@@ -1,3 +1,16 @@
+1999-07-11 Thomas Bushnell, BSG <tb@mit.edu>
+
+ * ugids-argp.c (parse_opt): Clarify if-then-else structure by
+ adding more braces.
+
+ * portinfo.c (print_port_info): Cast first arg of munmap
+ correctly.
+ (print_task_ports_info): Likewise.
+ * xportinfo.c (print_xlated_task_ports_info): Likewise.
+ * idvec-auth.c (idvec_merge_auth): Likewise.
+ * portxlate.c (port_name_xlator_create): Likewise.
+ (port_name_xlator_free): Likewise.
+
1999-07-10 Roland McGrath <roland@baalperazim.frob.com>
* portinfo.h: Add #include <sys/mman.h> for munmap decl.
diff --git a/libshouldbeinlibc/portinfo.c b/libshouldbeinlibc/portinfo.c
index 19e954c8..b04014da 100644
--- a/libshouldbeinlibc/portinfo.c
+++ b/libshouldbeinlibc/portinfo.c
@@ -121,7 +121,7 @@ print_port_info (mach_port_t name, mach_port_type_t type, task_t task,
for (i = 1; i < members_len; i++)
fprintf (stream, hex_names ? ", %#x" : ", %u", members[i]);
fprintf (stream, ")");
- munmap (members, members_len * sizeof *members);
+ munmap ((caddr_t) members, members_len * sizeof *members);
}
}
}
@@ -148,8 +148,8 @@ print_task_ports_info (task_t task, mach_port_type_t only,
if (types[i] & only)
print_port_info (names[i], types[i], task, show, stream);
- munmap (names, names_len * sizeof *names);
- munmap (types, types_len * sizeof *types);
+ munmap ((caddr_t) names, names_len * sizeof *names);
+ munmap ((caddr_t) types, types_len * sizeof *types);
return 0;
}
diff --git a/libshouldbeinlibc/portxlate.c b/libshouldbeinlibc/portxlate.c
index 9f222539..86a36101 100644
--- a/libshouldbeinlibc/portxlate.c
+++ b/libshouldbeinlibc/portxlate.c
@@ -60,8 +60,10 @@ port_name_xlator_create (mach_port_t from_task, mach_port_t to_task,
}
else
{
- munmap (x->to_names, x->to_names_len * sizeof (mach_port_t));
- munmap (x->to_types, x->to_types_len * sizeof (mach_port_type_t));
+ munmap ((caddr_t) x->to_names,
+ x->to_names_len * sizeof (mach_port_t));
+ munmap ((caddr_t) x->to_types,
+ x->to_types_len * sizeof (mach_port_type_t));
err = ENOMEM;
}
}
@@ -85,8 +87,8 @@ port_name_xlator_free (struct port_name_xlator *x)
mach_port_deallocate (mach_task_self (), x->ports[i]);
free (x->ports);
- munmap (x->to_names, x->to_names_len * sizeof (mach_port_t));
- munmap (x->to_types, x->to_types_len * sizeof (mach_port_type_t));
+ munmap ((caddr_t) x->to_names, x->to_names_len * sizeof (mach_port_t));
+ munmap ((caddr_t) x->to_types, x->to_types_len * sizeof (mach_port_type_t));
mach_port_deallocate (mach_task_self (), x->to_task);
mach_port_deallocate (mach_task_self (), x->from_task);
diff --git a/libshouldbeinlibc/ugids-argp.c b/libshouldbeinlibc/ugids-argp.c
index d80f27f7..809da784 100644
--- a/libshouldbeinlibc/ugids-argp.c
+++ b/libshouldbeinlibc/ugids-argp.c
@@ -1,6 +1,6 @@
/* Parse user and group ids
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -60,18 +60,22 @@ parse_opt (int key, char *arg, struct argp_state *state)
return ARGP_ERR_UNKNOWN;
if (key == ARGP_KEY_END)
- if (ugids_is_empty (ugids))
- if (params->default_user >= 0)
- uid = params->default_user;
- else if (params->require_ids)
+ {
+ if (ugids_is_empty (ugids))
{
- argp_error (state, "No ids specified");
- return EINVAL;
+ if (params->default_user >= 0)
+ uid = params->default_user;
+ else if (params->require_ids)
+ {
+ argp_error (state, "No ids specified");
+ return EINVAL;
+ }
+ else
+ break;
}
- else
+ else
break;
- else
- break;
+ }
else if (isdigit (*arg))
uid = atoi (arg);
else if (strcmp (arg, "-") == 0)
@@ -90,20 +94,22 @@ parse_opt (int key, char *arg, struct argp_state *state)
}
if (key == ARGP_KEY_ARG || key == ARGP_KEY_END)
- /* A user arg, which means add the user, and any appropriate
- groups. */
- if (!params->user_args_are_effective
- && !params->user_args_are_available)
- return ugids_set_posix_user (ugids, uid);
- else
- {
- error_t err = 0;
- if (params->user_args_are_effective)
- err = ugids_add_user (ugids, uid, 0);
- if (!err && params->user_args_are_available)
- err = ugids_add_user (ugids, uid, 1);
- return err;
- }
+ {
+ /* A user arg, which means add the user, and any appropriate
+ groups. */
+ if (!params->user_args_are_effective
+ && !params->user_args_are_available)
+ return ugids_set_posix_user (ugids, uid);
+ else
+ {
+ error_t err = 0;
+ if (params->user_args_are_effective)
+ err = ugids_add_user (ugids, uid, 0);
+ if (!err && params->user_args_are_available)
+ err = ugids_add_user (ugids, uid, 1);
+ return err;
+ }
+ }
else
/* Add an individual specific effective/auxiliary uid. */
return ugids_add_uid (ugids, uid, key == 'U');
diff --git a/libshouldbeinlibc/xportinfo.c b/libshouldbeinlibc/xportinfo.c
index bcd6abfa..f94bc4bd 100644
--- a/libshouldbeinlibc/xportinfo.c
+++ b/libshouldbeinlibc/xportinfo.c
@@ -59,8 +59,8 @@ print_xlated_task_ports_info (struct port_name_xlator *x,
if (types[i] & only)
print_xlated_port_info (names[i], types[i], x, show, stream);
- munmap (names, names_len * sizeof *names);
- munmap (types, types_len * sizeof *types);
+ munmap ((caddr_t) names, names_len * sizeof *names);
+ munmap ((caddr_t) types, types_len * sizeof *types);
return 0;
}