From: Razvan Deaconescu Date: Sat, 21 May 2011 10:04:09 +0000 (+0300) Subject: raw: sw_close and sw_shutdown use list_remove_socket. X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=d0689e2518820aed3edc27ef71e54acaec2534c1;p=swifty.git raw: sw_close and sw_shutdown use list_remove_socket. --- diff --git a/src/raw/swift_raw.c b/src/raw/swift_raw.c index 6796854..cc1109a 100644 --- a/src/raw/swift_raw.c +++ b/src/raw/swift_raw.c @@ -376,6 +376,7 @@ int sw_setsockopt(int __fd, int __level, int __optname, int sw_shutdown(int __fd, int __how) { struct sock_list *list; + int rc; /* Find socket in management structure. */ list = list_elem_from_socket(__fd); @@ -406,8 +407,8 @@ int sw_shutdown(int __fd, int __how) /* Remove socket from socket management structure. */ if (list->rw_state == STATE_SHUT_RDWR) { - list = list_unlink_socket(__fd); - if (list == NULL) { + rc = list_remove_socket(__fd); + if (rc < 0) { errno = EBADF; goto list_unlink_err; } @@ -428,11 +429,11 @@ list_unlink_err: */ int sw_close(int __fd) { - struct sock_list *list; + int rc; /* Remove socket from socket management structure. */ - list = list_unlink_socket(__fd); - if (list == NULL) { + rc = list_remove_socket(__fd); + if (rc < 0) { errno = EBADF; goto list_unlink_err; }