Page MenuHome GnuPG

w32: fix GNUPG_INVALID_FD and ASSUAN_INVALID_FD
Open, LowPublic

Description

I learned that INVALID_HANDLE_VALUE is defined as:

#define INVALID_HANDLE_VALUE ((HANDLE) (LONG_PTR)-1)

(I checked by mingw, but it's same on Windows proper.)

And I read the blog entry:
https://devblogs.microsoft.com/oldnewthing/20250326-00/?p=111002

I don't think the article is accurate (somehow confusing between the constant value and argument passing) about the C language, but it would make sense about Microsoft compiler.

In the C language, IIUC, it is implementation-defined behavior when we use cast operator to integer value other than 0.

Anyway, practically, it would be safer for us to do same.

If we follow the practice of use of cast to an integral type (which is large enough) first, we would need to fix GNUPG_INVALID_FD and ASSUAN_INVALID_FD, putting (intptr_t).

Event Timeline

gniibe created this task.