On Sun, 11 Sep 2022 11:29:07 -0500, Charles Mills wrote:

>    ... Bad open of course yields a bad fd which yields a -21. It is all new 
> code and I had not tested open failures specifically. 
>
>Not sure where you saw the example that you cited. The IBM doc that I am 
>looking at has the following for an example (in its entirety):
>
>"open /u/linda/my.exec" o_rdwr+o_trunc+o_creat 700
>
>which is of course useless with regard to how one checks for errors. IBM could 
>do better, especially if open is atypical in how it reports errors. 
>
>(https://www.ibm.com/docs/en/zos/2.5.0?topic=descriptions-open)
>
-1 is highly typical among UNIX functions, perhaps even in the purview
of "ça va sans dire", but there are numerous atypical cases for which the
programmer must check ERRNO; for example EAGAIN.  If you intend
to read from a transient stream (pipe, terminal), you should check EAGAIN.

-21 is extraordinary.  If it's not clearly documented (where?) it merits an 
RCF';
probably even an SR.

-- 
gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to