When trying to re-use the same service name, bind will fail but it means
a server is already listening on this service.
err = bind(fd, (struct sockaddr *)&addr,
sizeof(struct sockaddr_nfc_llcp));
if (err < 0) {
- near_error("%s bind failed %d", driver->name, err);
+ if (errno == EADDRINUSE) {
+ DBG("%s is already bound", driver->name);
+ return 0;
+ }
+
+ near_error("%s bind failed %d %d", driver->name, err, errno);
close(fd);
return err;