{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"",
"gen_ut":1752655995,
"reponame":"libwebsockets",
"desc":"libwebsockets lightweight C networking library",
"owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets",
"f":3,
"items": [
{"schema":"libjg2-1",
"cid":"7abb877a6b6dfa474163828f7636430a",
"commit": {"type":"commit",
"time": 1576367728,
"time_ofs": 0,
"oid_tree": { "oid": "ad30f8c2243031e13476f9d9e33bd1cee962f001", "alias": []},
"oid":{ "oid": "392dfe186bf6d12df5aeceeb6857b2794a720908", "alias": []},
"msg": "LWS_ERRNO: audit uses for case logging may destroy errno",
"sig_commit": { "git_time": { "time": 1576367728, "offset": 0 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },
"sig_author": { "git_time": { "time": 1576173696, "offset": 0 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }},
"body": "LWS_ERRNO: audit uses for case logging may destroy errno\n\nOn some platforms, it's possible that logging flow may reset errno. In the case where\nwe try to log errno on those platforms and afterwards try to query it, we will get a\nnasty surprise that the logged errno is destroyed by the time we come to test it.\n\nIn the two cases of this in the tree at the moment, sample errno into a temp and\nlog and test the temp.\n\nThanks to Sakthi Ramabadran for finding this."
,
"diff": "diff --git a/lib/core-net/network.c b/lib/core-net/network.c\nindex feab9fa..c53d4fb 100644\n--- a/lib/core-net/network.c\n+++ b/lib/core-net/network.c\n@@ -297,12 +297,14 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,\n \t} else\n #endif\n \tif (n \u003c 0) {\n+\t\tint _lws_errno \u003d LWS_ERRNO;\n+\n \t\tlwsl_err(\u0022ERROR on binding fd %d to port %d (%d %d)\u005cn\u0022,\n-\t\t\t sockfd, port, n, LWS_ERRNO);\n+\t\t\t sockfd, port, n, _lws_errno);\n \n \t\t/* if something already listening, tell caller to fail permanently */\n \n-\t\tif (LWS_ERRNO \u003d\u003d LWS_EADDRINUSE)\n+\t\tif (_lws_errno \u003d\u003d LWS_EADDRINUSE)\n \t\t\treturn LWS_ITOSA_BUSY;\n \n \t\t/* otherwise ask caller to retry later */\ndiff --git a/lib/roles/http/client/client-handshake.c b/lib/roles/http/client/client-handshake.c\nindex d891c6d..efc3d56 100644\n--- a/lib/roles/http/client/client-handshake.c\n+++ b/lib/roles/http/client/client-handshake.c\n@@ -582,13 +582,15 @@ ads_known:\n \n \tm \u003d connect(wsi-\u003edesc.sockfd, (const struct sockaddr *)psa, n);\n \tif (m \u003d\u003d -1) {\n-\t\tlwsl_debug(\u0022%s: connect says errno: %d\u005cn\u0022, __func__, LWS_ERRNO);\n+\t\tint errno_copy \u003d LWS_ERRNO;\n \n-\t\tif (LWS_ERRNO !\u003d LWS_EALREADY \u0026\u0026\n-\t\t LWS_ERRNO !\u003d LWS_EINPROGRESS \u0026\u0026\n-\t\t LWS_ERRNO !\u003d LWS_EWOULDBLOCK\n+\t\tlwsl_debug(\u0022%s: connect says errno: %d\u005cn\u0022, __func__, errno_copy);\n+\n+\t\tif (errno_copy !\u003d LWS_EALREADY \u0026\u0026\n+\t\t errno_copy !\u003d LWS_EINPROGRESS \u0026\u0026\n+\t\t errno_copy !\u003d LWS_EWOULDBLOCK\n #ifdef _WIN32\n-\t\t\t\u0026\u0026 LWS_ERRNO !\u003d WSAEINVAL\n+\t\t\t\u0026\u0026 errno_copy !\u003d WSAEINVAL\n #endif\n \t\t) {\n #if defined(_DEBUG)\n","s":{"c":1752655995,"u": 3098}}
],"g": 4449,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}