in reply to Re^3: Why does fpathconf give "bad file descriptor"?
in thread Why does fpathconf give "bad file descriptor"?

His original code gives no warnings. And 0 + $wd doesn't evaluate to 0. I think it evaluates to the address of the object.

Looking at the code for fpathconf in glibc, I see that, for 16 of the 21 configuration parameters, fd is ignored—except to check that it is >= 0. So I think what's happening is that when the objects are being allocated above (void *)((unsigned int)-1 >> 1), when it's passed as an int, it's negative, so it gives an error.

  • Comment on Re^4: Why does fpathconf give "bad file descriptor"?

Replies are listed 'Best First'.
Re^5: Why does fpathconf give "bad file descriptor"?
by ikegami (Patriarch) on Mar 31, 2010 at 22:05 UTC

    Ah! He said glob in Re^2, but he's actually passing a ref to a glob in the OP (which becomes a number with no warning).

      Yes, sorry, I was unclear: the code I am using is identical to my original post so I'm using a ref. I do indeed use -w and use strict always.