Print this page
10141 smatch fix for zoneadmd

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/zoneadmd/zoneadmd.c
          +++ new/usr/src/cmd/zoneadmd/zoneadmd.c
↓ open down ↓ 2266 lines elided ↑ open up ↑
2267 2267                  if ((fdetach(zone_door_path) == 0) || (errno != EBUSY))
2268 2268                          break;
2269 2269                  yield();
2270 2270          }
2271 2271  
2272 2272          for (;;)
2273 2273                  (void) pause();
2274 2274  
2275 2275  child_out:
2276 2276          assert(pid == 0);
2277      -        if (shstate != NULL) {
2278      -                shstate->status = -1;
2279      -                (void) sema_post(&shstate->sem);
2280      -                (void) munmap((char *)shstate, shstatelen);
2281      -        }
2282 2277  
     2278 +        shstate->status = -1;
     2279 +        (void) sema_post(&shstate->sem);
     2280 +        (void) munmap((char *)shstate, shstatelen);
     2281 +
2283 2282          /*
2284 2283           * This might trigger an unref notification, but if so,
2285 2284           * we are still holding the lock, so our call to exit will
2286 2285           * ultimately win the race and will publish the right exit
2287 2286           * code.
2288 2287           */
2289 2288          if (zone_door != -1) {
2290 2289                  assert(MUTEX_HELD(&lock));
2291 2290                  (void) door_revoke(zone_door);
2292 2291                  (void) fdetach(zone_door_path);
2293 2292          }
2294 2293  
2295 2294          if (dld_handle != NULL)
2296 2295                  dladm_close(dld_handle);
2297 2296  
2298 2297          return (1); /* return from main() forcibly exits an MT process */
2299 2298  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX