- char *ok = scope > UINT_MAX
- ? 0 /* we can't pass it to if_indextoname then */
- : if_indextoname(scope, scopeptr);
- if (!ok) {
- if (errno==ENXIO) {
- /* fair enough, show it as a number then */
- } else if (addrtext_our_errno(errno)) {
- /* we use these for other purposes, urgh. */
- perror("adns: adns_addr2text: if_indextoname"
- " failed with unexpected error");
- return EIO;
- } else {
- return errno;
+ bool parsedname = 0;
+ if (scope <= UINT_MAX /* so we can pass it to if_indextoname */
+ && addrtext_scope_use_ifname(sa)) {
+ parsedname = if_indextoname(scope, scopeptr);
+ if (!parsedname) {
+ if (errno==ENXIO) {
+ /* fair enough, show it as a number then */
+ } else if (addrtext_our_errno(errno)) {
+ /* we use these for other purposes, urgh. */
+ perror("adns: adns_addr2text: if_indextoname"
+ " failed with unexpected error");
+ return EIO;
+ } else {
+ return errno;
+ }