Skip to content

Commit dc32016

Browse files
committed
unix/modsocket: Add comment regarding close() error checking (which is none).
1 parent 4f72aa8 commit dc32016

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

unix/modsocket.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ STATIC mp_uint_t socket_write(mp_obj_t o_in, const void *buf, mp_uint_t size, in
114114

115115
STATIC mp_obj_t socket_close(mp_obj_t self_in) {
116116
mp_obj_socket_t *self = MP_OBJ_TO_PTR(self_in);
117+
// There's a POSIX drama regarding return value of close in general,
118+
// and EINTR error in particular. See e.g.
119+
// http://lwn.net/Articles/576478/
120+
// http://austingroupbugs.net/view.php?id=529
121+
// The rationale MicroPython follows is that close() just releases
122+
// file descriptor. If you're interested to catch I/O errors before
123+
// closing fd, fsync() it.
117124
close(self->fd);
118125
return mp_const_none;
119126
}

0 commit comments

Comments
 (0)