[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MiNT] MiNTlibs for PureC
Hallo Thomas,
TB>> If 'name' doesn't exist, open returns -4, not -1.
TB>
TB>Then this is a bug in open(), as for /any/ error, -1 is to be returned,
TB>with errno set to the corresponding error code.
Agreed!
The reason for this behaviour is to be found in fcntl.h #87:
/* smallest valid gemdos handle */
/* note handle is only word (16 bit) negative, not long negative,
and since Fopen etc are declared as returning long in osbind.h
the sign-extension will not happen -- thanks ers
*/
#ifdef __MSHORT__
#define __SMALLEST_VALID_HANDLE (-3)
#else
#define __SMALLEST_VALID_HANDLE (0)
#endif
So the -1 would have to be rplaced by __SMALLEST_VALID_HANDLE -1
whenever a file-handle is returned !?
Sure there are devices with negative handles but are they returned by
open et al and/or does mintlib have to support this?
bye, Helmut