Changeset 15343
- Timestamp:
- 04/22/12 01:11:46 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/inetwork.h
r15146 r15343 121 121 node->device = device; 122 122 } 123 else 124 free(device); 123 125 124 126 if(ostrcmp(node->ip, ip) != 0) … … 127 129 node->ip = ip; 128 130 } 131 else 132 free(ip); 129 133 130 134 if(ostrcmp(node->netmask, netmask) != 0) … … 133 137 node->netmask = netmask; 134 138 } 139 else 140 free(netmask); 135 141 136 142 if(ostrcmp(node->broadcast, broadcast) != 0) … … 139 145 node->broadcast = broadcast; 140 146 } 147 else 148 free(broadcast); 141 149 142 150 if(flag == 0) … … 147 155 node->mac = mac; 148 156 } 157 else 158 free(mac); 149 159 150 160 node->dhcp = dhcp; 151 161 } 162 else 163 free(mac); 164 152 165 node->found = 1; 153 166 … … 346 359 tmp_mac = command(cmd); 347 360 348 if (tmp_mac != 0)349 tmp_mac = string_newline( ostrcat(tmp_mac, "", 1, 0));361 if(tmp_mac != NULL) 362 tmp_mac = string_newline(tmp_mac); 350 363 else 351 364 tmp_mac = ostrcat(tmp_mac, "00:00:00:00:00:00", 1, 0); … … 368 381 { 369 382 if(self == NULL) 370 node = changeinetwork(tmp_device, tmp_ipaddresse, tmp_netmask, tmp_mac, 383 node = changeinetwork(tmp_device, tmp_ipaddresse, tmp_netmask, tmp_mac, tmp_broadcast, tmp_dhcp, tmpinetwork, 0); 371 384 else 372 node = changeinetwork(tmp_device, tmp_ipaddresse, tmp_netmask, tmp_mac, 373 } 374 else 375 node = addinetwork(tmp_device, tmp_ipaddresse, tmp_netmask, tmp_mac, 385 node = changeinetwork(tmp_device, tmp_ipaddresse, tmp_netmask, tmp_mac, tmp_broadcast, tmp_dhcp, tmpinetwork, 1); 386 } 387 else 388 node = addinetwork(tmp_device, tmp_ipaddresse, tmp_netmask, tmp_mac, tmp_broadcast, tmp_dhcp, node); 376 389 377 390 free(cmd); cmd = NULL; … … 384 397 if(self == NULL) 385 398 { 399 free(status.gateway); status.gateway = NULL; 386 400 tmp_gateway = getdefaultgw(); 387 if 401 if(tmp_gateway != NULL) 388 402 { 389 403 tmpstr = fixip(tmp_gateway, 0); … … 394 408 395 409 // DNSSERVER1 410 free(status.dnsserver1); status.dnsserver1 = NULL; 396 411 cmd = ostrcat(cmd, "cat /var/etc/resolv.conf | grep nameserver | awk '{ print $2 }' | head -n1 | tail -n1", 1, 0); 397 412 tmp_dnsserver1 = ostrcat(tmp_dnsserver1 , command(cmd), 1, 1); 398 if 413 if(tmp_dnsserver1 != NULL) 399 414 { 400 415 tmpstr = fixip(tmp_dnsserver1, 0); … … 407 422 408 423 // DNSSERVER2 424 free(status.dnsserver2); status.dnsserver2 = NULL; 409 425 cmd = ostrcat(cmd, "cat /var/etc/resolv.conf | grep nameserver | awk '{ print $2 }' | head -n2 | tail -n1", 1, 0); 410 426 tmp_dnsserver2 = ostrcat(tmp_dnsserver2 , command(cmd), 1, 1); 411 if 427 if(tmp_dnsserver2 != NULL) 412 428 { 413 429 tmpstr = fixip(tmp_dnsserver2, 0);
Note: See TracChangeset
for help on using the changeset viewer.