asn1: Work around missing ENOTSUP (WIN32)

Sufficiently old CRTs on Windows lack ENOTSUP.  Use EINVAL instead then.
This commit is contained in:
Nicolas Williams
2021-11-23 18:11:48 -06:00
parent 92e5a4b7e5
commit 232c936ea3
3 changed files with 11 additions and 1 deletions

View File

@@ -273,6 +273,11 @@ init_generate (const char *filename, const char *base)
"#define ASN1CALL\n"
"#endif\n",
headerfile);
fputs("#ifndef ENOTSUP\n"
"/* Very old MSVC CRTs lack ENOTSUP */\n"
"#define ENOTSUP EINVAL\n"
"#endif\n",
headerfile);
fprintf (headerfile, "struct units;\n\n");
fprintf (headerfile, "#endif\n\n");
if (asprintf(&fn, "%s_files", base) < 0 || fn == NULL)