/* Module map.c */
void owner_map_read (char const *name);
-int owner_map_translate (uid_t uid, uid_t *new_uid, char const **new_name);
+void owner_map_translate (uid_t uid, uid_t *new_uid, char const **new_name);
void group_map_read (char const *file);
-int group_map_translate (gid_t gid, gid_t *new_gid, char const **new_name);
+void group_map_translate (gid_t gid, gid_t *new_gid, char const **new_name);
_GL_INLINE_HEADER_END
struct wordsplit ws;
int wsopt;
intmax_t line;
- int err = 0;
+ bool err = false;
fp = fopen (file, "r");
if (!fp)
if (ws.ws_wordc != 2)
{
error (0, 0, _("%s:%jd: malformed line"), file, line);
- err = 1;
+ err = true;
continue;
}
{
if (!parse_id (&orig_id, ws.ws_wordv[0]+1, what, maxval, file, line))
{
- err = 1;
+ err = true;
continue;
}
}
{
error (0, 0, _("%s:%jd: can't obtain %s of %s"),
file, line, what, ws.ws_wordv[0]);
- err = 1;
+ err = true;
continue;
}
}
*colon++ = 0;
if (!parse_id (&new_id, colon, what, maxval, file, line))
{
- err = 1;
+ err = true;
continue;
}
}
{
if (!parse_id (&new_id, ws.ws_wordv[1], what, maxval, file, line))
{
- err = 1;
+ err = true;
continue;
}
}
{
error (0, 0, _("%s:%jd: can't obtain %s of %s"),
file, line, what, ws.ws_wordv[1]);
- err = 1;
+ err = true;
continue;
}
}
map_read (&owner_map, file, name_to_uid, "UID", TYPE_MAXIMUM (uid_t));
}
-int
+void
owner_map_translate (uid_t uid, uid_t *new_uid, char const **new_name)
{
- int rc = 1;
-
if (owner_map)
{
struct mapentry ent, *res;
{
*new_uid = res->new_id;
*new_name = res->new_name;
- return 0;
+ return;
}
}
uid_t minus_1 = -1;
if (owner_option != minus_1)
- {
- *new_uid = owner_option;
- rc = 0;
- }
+ *new_uid = owner_option;
if (owner_name_option)
- {
- *new_name = owner_name_option;
- rc = 0;
- }
-
- return rc;
+ *new_name = owner_name_option;
}
\f
/* GID translation */
map_read (&group_map, file, name_to_gid, "GID", TYPE_MAXIMUM (gid_t));
}
-int
+void
group_map_translate (gid_t gid, gid_t *new_gid, char const **new_name)
{
- int rc = 1;
-
if (group_map)
{
struct mapentry ent, *res;
{
*new_gid = res->new_id;
*new_name = res->new_name;
- return 0;
+ return;
}
}
gid_t minus_1 = -1;
if (group_option != minus_1)
- {
- *new_gid = group_option;
- rc = 0;
- }
+ *new_gid = group_option;
if (group_name_option)
- {
- *new_name = group_name_option;
- rc = 0;
- }
-
- return rc;
+ *new_name = group_name_option;
}