+ int r;
+
+ if (ptr->fd == -1)
+ return MEMCACHED_SUCCESS;
+
+ /* in case of death shutdown to avoid blocking at close() */
+ r= shutdown(ptr->fd, SHUT_RDWR);
+
+#ifdef HAVE_DEBUG
+ if (r && errno != ENOTCONN)
+ {
+ WATCHPOINT_NUMBER(ptr->fd);
+ WATCHPOINT_ERRNO(errno);
+ WATCHPOINT_ASSERT(errno);
+ }
+#endif
+
+ r= close(ptr->fd);
+#ifdef HAVE_DEBUG
+ if (r != 0)
+ WATCHPOINT_ERRNO(errno);
+#endif