[OpenAFS] Re: tsmafs utility: rx_Read() returns 0?

Andrew Deason adeason@sinenomine.net
Wed, 17 Apr 2013 01:14:22 -0500

On Wed, 17 Apr 2013 01:55:26 +0000
Robert Sturrock <rns@unimelb.edu.au> wrote:

> (I'm not sure if this should go to openafs-info, or the devel list, so
> I apologise if I've gotten that wrong).

The readership of -devel is probably more appropriate for discussion
like this, but no worries.

> I suppose my question is: is it normal/ok for rx_Read() to return 0,
> or is this in itself indicative of a problem or bug somewhere?

If the call has an error, we return 0 (and a quick glance at the code,
I'm not sure I see any case where we return negative). 0 is also for eof
and maybe some other odd cases like Jeff mentions, but regardless, if
you know you're supposed to be getting more data (and for that code in
tsmafs, you do), a 0 is an error. OpenAFS code in general checks for
<= 0 for errors. I'm assuming you saw an actual error code printed out
when you modified the code as mentioned?

And giving a quick look to the tsmafs code around there, it seems to be
missing error checks on the first rx_Read32 calls, as well. If you want
to be like openafs code, check for <= 0 return, and look at rx_Error()
for the actual error code (which you do now). You can just print that
code directly, or use com_err functions to get an error message.

Andrew Deason