diff --git a/lib/asn1/gen.c b/lib/asn1/gen.c index 39ea9d037..84d31a859 100644 --- a/lib/asn1/gen.c +++ b/lib/asn1/gen.c @@ -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) diff --git a/lib/asn1/gen_print.c b/lib/asn1/gen_print.c index 5ff2da9b1..4cca9e044 100644 --- a/lib/asn1/gen_print.c +++ b/lib/asn1/gen_print.c @@ -38,6 +38,6 @@ generate_type_print_stub(const Symbol *s) { fprintf(codefile, "char * ASN1CALL\n" "print_%s(const %s *data, int flags)\n" - "{ errno = ENOTSUP; return 0; }\n\n", + "{ errno = EINVAL; return 0; }\n\n", s->gen_name, s->gen_name); } diff --git a/lib/asn1/template.c b/lib/asn1/template.c index 27f4300ee..cd6125241 100644 --- a/lib/asn1/template.c +++ b/lib/asn1/template.c @@ -38,6 +38,11 @@ #include #include +#ifndef ENOTSUP +/* Very old MSVC CRTs don't have ENOTSUP */ +#define ENOTSUP EINVAL +#endif + struct asn1_type_func asn1_template_prim[A1T_NUM_ENTRY] = { #define el(name, type) { \ (asn1_type_encode)der_put_##name, \