diff --git a/src/libckpool.c b/src/libckpool.c index bb34d79f..8cdd4ef1 100644 --- a/src/libckpool.c +++ b/src/libckpool.c @@ -440,13 +440,14 @@ void block_socket(int fd) fcntl(fd, F_SETFL, flags & ~O_NONBLOCK); } -void _Close(int *fd) +void _close(int *fd, const char *file, const char *func, const int line) { if (*fd < 0) return; LOGDEBUG("Closing file handle %d", *fd); if (unlikely(close(*fd))) - LOGWARNING("Close of fd %d failed with errno %d:%s", *fd, errno, strerror(errno)); + LOGWARNING("Close of fd %d failed with errno %d:%s from %s %s:%d", + *fd, errno, strerror(errno), file, func, line); *fd = -1; } diff --git a/src/libckpool.h b/src/libckpool.h index 26f6e670..b01967e5 100644 --- a/src/libckpool.h +++ b/src/libckpool.h @@ -426,8 +426,9 @@ void keep_sockalive(int fd); void nolinger_socket(int fd); void noblock_socket(int fd); void block_socket(int fd); -void _Close(int *fd); -#define Close(FD) _Close(&FD) +void _close(int *fd, const char *file, const char *func, const int line); +#define _Close(FD) _close(FD, __FILE__, __func__, __LINE__) +#define Close(FD) _close(&FD, __FILE__, __func__, __LINE__) int bind_socket(char *url, char *port); int connect_socket(char *url, char *port); int write_socket(int fd, const void *buf, size_t nbyte);