Print this page
smatch clean rtld


 992 cap_files(const char *str)
 993 {
 994         char    *caps, *name, *next;
 995 
 996         if ((caps = strdup(str)) == NULL)
 997                 return (0);
 998 
 999         for (name = strtok_r(caps, MSG_ORIG(MSG_CAP_DELIMIT), &next);
1000             name != NULL;
1001             name = strtok_r(NULL, MSG_ORIG(MSG_CAP_DELIMIT), &next)) {
1002                 avl_index_t     where;
1003                 PathNode        *pnp;
1004                 uint_t          hash = sgs_str_hash(name);
1005 
1006                 /*
1007                  * Determine whether this pathname has already been recorded.
1008                  */
1009                 if (pnavl_recorded(&capavl, name, hash, &where))
1010                         continue;
1011 
1012                 if ((pnp = calloc(sizeof (PathNode), 1)) != NULL) {
1013                         pnp->pn_name = name;
1014                         pnp->pn_hash = hash;
1015                         avl_insert(capavl, pnp, where);
1016                 }
1017         }
1018 
1019         return (1);
1020 }
1021 
1022 /*
1023  * Set alternative system capabilities.  A user can establish alternative system
1024  * capabilities from the environment, or from a configuration file.  This
1025  * routine is called in each instance.  Environment variables only set the
1026  * replaceable (rpl) variables.  Configuration files can set both replaceable
1027  * (rpl) and permanent (prm) variables.
1028  */
1029 int
1030 cap_alternative(void)
1031 {
1032         /*




 992 cap_files(const char *str)
 993 {
 994         char    *caps, *name, *next;
 995 
 996         if ((caps = strdup(str)) == NULL)
 997                 return (0);
 998 
 999         for (name = strtok_r(caps, MSG_ORIG(MSG_CAP_DELIMIT), &next);
1000             name != NULL;
1001             name = strtok_r(NULL, MSG_ORIG(MSG_CAP_DELIMIT), &next)) {
1002                 avl_index_t     where;
1003                 PathNode        *pnp;
1004                 uint_t          hash = sgs_str_hash(name);
1005 
1006                 /*
1007                  * Determine whether this pathname has already been recorded.
1008                  */
1009                 if (pnavl_recorded(&capavl, name, hash, &where))
1010                         continue;
1011 
1012                 if ((pnp = calloc(1, sizeof (PathNode))) != NULL) {
1013                         pnp->pn_name = name;
1014                         pnp->pn_hash = hash;
1015                         avl_insert(capavl, pnp, where);
1016                 }
1017         }
1018 
1019         return (1);
1020 }
1021 
1022 /*
1023  * Set alternative system capabilities.  A user can establish alternative system
1024  * capabilities from the environment, or from a configuration file.  This
1025  * routine is called in each instance.  Environment variables only set the
1026  * replaceable (rpl) variables.  Configuration files can set both replaceable
1027  * (rpl) and permanent (prm) variables.
1028  */
1029 int
1030 cap_alternative(void)
1031 {
1032         /*