[haiku-commits] Re: haiku: hrev49468 - in src: kits/network/libnetapi apps/screenshot
- From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
- To: haiku-commits@xxxxxxxxxxxxx
- Date: Tue, 28 Jul 2015 20:54:24 +0200
Am 28/07/2015 um 17:33 schrieb waddlesplash@xxxxxxxxx:
@@ -151,7 +151,7 @@ BNetworkAddress::Unset()
{
fAddress.ss_family = AF_UNSPEC;
fAddress.ss_len = 2;
- fStatus = B_OK;
+ fStatus = B_NO_INIT;
}
On second thought, B_NO_INIT doesn't make any sense for BNetworkAddress.
An empty address is still a valid address (unlike a BFile object that
hasn't been initialized yet).
@@ -177,8 +177,10 @@ BNetworkAddress::SetTo(const char* host, uint16 port,
uint32 flags)
cookie = 0;
status = resolver->GetNextAddress(&cookie, *this);
- if (status == B_OK)
- fStatus = B_OK;
+ if (status != B_OK) {
+ Unset();
+ fStatus = status;
+ }
If fStatus was not B_OK, it's still not B_OK after this, but should be.
Correct would be:
fStatus = ...
if (fStatus != B_OK)
_Unset();
return fStatus;
Note the underscore infront of Unset() -- I'd add a private method that
does not set fStatus for this.
Bye,
Axel.
Other related posts: