1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-15 00:37:36 +00:00
serenity/Ports/python3/patches/0006-Workaround-for-unsupported-socket-option.patch
Humberto Alves fb5a39498a Ports/python3: Make pip work
Add two patches to allow Python's package manager to work on Serenity:

- The first one enables zlib module, which is needed for `ensurepip`
  command;
- The second patch fixes pip downloads, so it's possible to install
  packages from the PyPI repository.
2022-09-02 14:03:24 +01:00

26 lines
995 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Humberto Alves <hjalves@live.com>
Date: Fri, 2 Sep 2022 03:31:42 +0100
Subject: [PATCH] Workaround for unsupported socket option
This is a workaround for ignoring the result of `setsockopt` call when
given `TCP_NODELAY` as an argument. This TCP socket option is used in
many applications (like pip and requests) for optimization purposes.
For now, it can be safely ignored until it's supported in the kernel.
---
Modules/socketmodule.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 0109d97..484e651 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -3003,6 +3003,8 @@ sock_setsockopt(PySocketSockObject *s, PyObject *args)
PyBuffer_Release(&optval);
done:
+ if (res < 0 && level == IPPROTO_TCP && optname == TCP_NODELAY && errno == ENOPROTOOPT)
+ res = 0;
if (res < 0) {
return s->errorhandler();
}