Skip to content

Commit 1374b76

Browse files
authored
Merge pull request #2031 from sundtek/patch-1
Update hm2_eth.c
2 parents 9621868 + b5e3148 commit 1374b76

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/hal/drivers/mesa-hostmot2/hm2_eth.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -746,19 +746,23 @@ static int init_board(hm2_eth_t *board, const char *board_ip) {
746746
}
747747

748748
static int close_board(hm2_eth_t *board) {
749-
749+
int ret;
750750
board->llio.reset(&board->llio);
751751

752752
if(use_iptables()) clear_iptables();
753753

754754
if(board->req.arp_flags & ATF_PERM) {
755-
int ret = ioctl_siocdarp(board);
755+
ret = ioctl_siocdarp(board);
756756
if(ret < 0) perror("ioctl SIOCDARP");
757757
}
758-
int ret = shutdown(board->sockfd, SHUT_RDWR);
759-
if (ret < 0)
758+
ret = shutdown(board->sockfd, SHUT_RDWR);
759+
if (ret == -1)
760+
LL_PRINT("ERROR: can't shutdown socket: %s\n", strerror(errno));
761+
762+
ret = close(board->sockfd);
763+
if (ret == -1)
760764
LL_PRINT("ERROR: can't close socket: %s\n", strerror(errno));
761-
765+
762766
return ret < 0 ? -errno : 0;
763767
}
764768

0 commit comments

Comments
 (0)