On Sun, Apr 8, 2012 at 10:43 AM, Paul Gilmartin <[email protected]>wrote:

> On Sun, 8 Apr 2012 09:55:46 -0600, Steve Comstock wrote:
>
> >On 4/8/2012 9:46 AM, Sam Siegel wrote:
> >> I'm trying to find the manual (by full name or number) that provides
> >> precise definitions about  pathnames (hfs and zfs) for the unix
> subsystem
> >> on zos.  Specifically, I'm interested in knowing the maximum length:
> >>
> >> 1) Entire path from '/' on down
> >> 2) Maximum number of characters in a file in a directory
> >>    ...
> >
> >1. 1023
> >
> >2. 255
> >
> This is probably in /usr/include/limits.h
>
> With some nasty associated facts that I learned when I was trying
> to write a command interface to realpath():
>
> o realpath() appears to provide no protection against buffer overrun.
>
> o By descending a directory hierarchy, one can create a pathname
>  far longer than that limit.
>
> o While many UNIX-like systems provide a definition of PATH_MAX
>  in /usr/include/limits.h, POSIX deprecates this, and USS does not
>  provide one.  IBM gives the rationale that the limit is filesystem-
>  dependent and code relying on it might become obsoleted by
>  new technology.
>
> o A very deep path can cause "rm -rf" to fail in violation of POSIX
>  spec with a "too many open files" error.
>

Paul - Thanks for the tips.  The code does not create any path segments.

My goal here is to be able to point the user to the reference manuals so
they can determine what is appropriate for their use.  It is
their responsibility to allocate a buffer large enough to hold any
path/file name they create.  When they call my function, they provide the
address of the buffer and the number of bytes in the buffer.  A new buffer
is allocated (specified size + 2) and the specified number of bytes are
copied and a tailing x'0000' is appended.  My buffer  is passed to the
C/C++ runtime fopen function.  If the path/filename provided is invalid,
the open fails and the error is returned to the caller.

Thanks,
Sam


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

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

Reply via email to