Re: [PATCH 4/4] bb_lookup_port(): return 0 if lookup failed

2021-09-10 Thread Denys Vlasenko
On Fri, Sep 10, 2021 at 12:25 AM Sergey Ponomarev wrote: > the bb_lookup_port() is a library function and I'm not sure if it's fine to > die. It's ok to die. We can review all callers. So far I don't see which caller needs to stay alive aftes this error. > There are already some error messages

Re: [PATCH 4/4] bb_lookup_port(): return 0 if lookup failed

2021-09-09 Thread Sergey Ponomarev
the bb_lookup_port() is a library function and I'm not sure if it's fine to die. There are already some error messages like: o_lport = bb_lookup_port(str_p, o_udpmode ? "udp" : "tcp"); if (!o_lport) bb_error_msg_and_die("bad local port '%s'",

Re: [PATCH 4/4] bb_lookup_port(): return 0 if lookup failed

2021-09-09 Thread Denys Vlasenko
On Wed, Aug 25, 2021 at 10:15 PM Sergey Ponomarev wrote: > Unlike xatou16() the bb_lookup_port() won't exit program if port parsing is > failed. > But it may return a default_port instead. This is not safe because user > requested another port. > Instead, we return 0 and caller may gracefully

[PATCH 4/4] bb_lookup_port(): return 0 if lookup failed

2021-08-25 Thread Sergey Ponomarev
Unlike xatou16() the bb_lookup_port() won't exit program if port parsing is failed. But it may return a default_port instead. This is not safe because user requested another port. Instead, we return 0 and caller may gracefully show a message or just pass it further. Since the default_port is