Print this page
6139 help gcc figure out variable initialization

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libhotplug/common/libhotplug.c
          +++ new/usr/src/lib/libhotplug/common/libhotplug.c
↓ open down ↓ 455 lines elided ↑ open up ↑
 456  456          (void) memset(path, 0, MAXPATHLEN);
 457  457          (void) memset(connection, 0, MAXPATHLEN);
 458  458          (void) memset(components, 0, MAXPATHLEN);
 459  459  
 460  460          /*  Set 'connection' only for connectors and ports */
 461  461          if ((node->hp_type == HP_NODE_CONNECTOR) ||
 462  462              (node->hp_type == HP_NODE_PORT))
 463  463                  (void) strlcpy(connection, node->hp_name, MAXPATHLEN);
 464  464  
 465  465          /* Trace back to the root node, accumulating components */
 466      -        for (parent = node; parent != NULL; parent = parent->hp_parent) {
      466 +        for (parent = node, root = parent; parent != NULL;
      467 +            root = parent, parent = parent->hp_parent) {
 467  468                  if (parent->hp_type == HP_NODE_DEVICE) {
 468  469                          (void) strlcat(components, "/", MAXPATHLEN);
 469  470                          (void) strlcat(components, parent->hp_name, MAXPATHLEN);
 470  471                  }
 471      -                if (parent->hp_parent == NULL)
 472      -                        root = parent;
 473  472          }
 474  473  
 475  474          /* Ensure the snapshot actually contains a base path */
 476  475          if (root->hp_basepath == NULL) {
 477  476                  i_hp_dprintf("hp_path: missing base pathname.\n");
 478  477                  return (EFAULT);
 479  478          }
 480  479  
 481  480          /*
 482  481           * Construct the path.  Start with the base path from the root
↓ open down ↓ 885 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX