Print this page
OS-1574 libzdoor checks for NULL that cannot be

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libzdoor/common/zdoor-int.c
          +++ new/usr/src/lib/libzdoor/common/zdoor-int.c
↓ open down ↓ 152 lines elided ↑ open up ↑
 153  153   * that code zone_enter will kick back EINVAL).
 154  154   */
 155  155  int
 156  156  zdoor_fattach(zoneid_t zoneid, const char *service, int door, int detach_only)
 157  157  {
 158  158          int fd = 0;
 159  159          int len = 0;
 160  160          int pid = 0;
 161  161          int stat = 0;
 162  162          int tmpl_fd = 0;
 163      -        char path[MAXPATHLEN]  = {0};
      163 +        char path[MAXPATHLEN] = {0};
 164  164          ctid_t ct = -1;
 165  165  
 166  166          if (zoneid < 0) {
 167  167                  zdoor_debug("zdoor_fattach: zoneid < 0");
 168  168                  return (ZDOOR_ARGS_ERROR);
 169  169          }
 170  170  
 171      -        if (path == NULL) {
 172      -                zdoor_debug("zdoor_fattach: NULL PATH");
      171 +        if (service == NULL) {
      172 +                zdoor_debug("zdoor_fattach: NULL service");
 173  173                  return (ZDOOR_ARGS_ERROR);
 174  174          }
 175  175  
 176  176          if ((tmpl_fd = init_template()) < 0) {
 177  177                  zdoor_warn("zdoor_fattach: init contract for %d:%s failed",
 178  178                      zoneid, service);
 179  179                  return (ZDOOR_ERROR);
 180  180          }
 181  181  
 182  182          len = snprintf(NULL, 0, ZDOOR_FMT_STR, service) + 1;
↓ open down ↓ 144 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX