Print this page
OS-4251 lxbrand want lx_init for less boot-time overrides
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
OS-4254 libbrand token substitution incomplete for mount entries

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libbrand/common/libbrand.c
          +++ new/usr/src/lib/libbrand/common/libbrand.c
↓ open down ↓ 809 lines elided ↑ open up ↑
 810  810  }
 811  811  
 812  812  static int
 813  813  i_brand_platform_iter_mounts(struct brand_handle *bhp, const char *zonename,
 814  814      const char *zonepath, int (*func)(void *, const char *, const char *,
 815  815      const char *, const char *), void *data, const xmlChar *mount_type)
 816  816  {
 817  817          xmlNodePtr node;
 818  818          xmlChar *special, *dir, *type, *opt;
 819  819          char special_exp[MAXPATHLEN];
      820 +        char dir_exp[MAXPATHLEN];
 820  821          char opt_exp[MAXPATHLEN];
 821  822          int ret;
 822  823  
 823  824          if ((node = xmlDocGetRootElement(bhp->bh_platform)) == NULL)
 824  825                  return (-1);
 825  826  
 826  827          for (node = node->xmlChildrenNode; node != NULL; node = node->next) {
 827  828  
 828  829                  if (xmlStrcmp(node->name, mount_type) != 0)
 829  830                          continue;
↓ open down ↓ 6 lines elided ↑ open up ↑
 836  837                      (opt == NULL)) {
 837  838                          ret = -1;
 838  839                          goto next;
 839  840                  }
 840  841  
 841  842                  /* Substitute token values as needed. */
 842  843                  if ((ret = i_substitute_tokens((char *)special,
 843  844                      special_exp, sizeof (special_exp),
 844  845                      zonename, zonepath, NULL, NULL)) != 0)
 845  846                          goto next;
      847 +                if ((ret = i_substitute_tokens((char *)dir,
      848 +                    dir_exp, sizeof (dir_exp),
      849 +                    zonename, zonepath, NULL, NULL)) != 0)
      850 +                        goto next;
 846  851  
 847  852                  /* opt might not be defined */
 848  853                  if (strlen((const char *)opt) == 0) {
 849  854                          xmlFree(opt);
 850  855                          opt = NULL;
 851  856                  } else {
 852  857                          if ((ret = i_substitute_tokens((char *)opt,
 853  858                              opt_exp, sizeof (opt_exp),
 854  859                              zonename, zonepath, NULL, NULL)) != 0)
 855  860                                  goto next;
 856  861                  }
 857  862  
 858      -                ret = func(data, (char *)special_exp, (char *)dir,
      863 +                ret = func(data, (char *)special_exp, (char *)dir_exp,
 859  864                      (char *)type, ((opt != NULL) ? opt_exp : NULL));
 860  865  
 861  866  next:
 862  867                  if (special != NULL)
 863  868                          xmlFree(special);
 864  869                  if (dir != NULL)
 865  870                          xmlFree(dir);
 866  871                  if (type != NULL)
 867  872                          xmlFree(type);
 868  873                  if (opt != NULL)
↓ open down ↓ 176 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX