Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: zasprintf
- X-seq: zsh-workers 12820
- From: Zefram <zefram@xxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- Subject: Re: PATCH: zasprintf
- Date: Sun, 17 Sep 2000 13:21:23 +0100 (BST)
- Cc: zsh-workers@xxxxxxxxxxxxxx
- In-reply-to: <1000917004721.ZM18698@xxxxxxxxxxxxxxxxxxxxxxx> from Bart Schaefer at "Sep 17, 2000 00:47:20 am"
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Bart Schaefer wrote:
>The last, special case is to create a "big enough" buffer for use by
>readlink(). In this case I think we could use lstat() to read the size
>of the link itself, and use that to allocate a buffer. Does anyone
>know of an operating system where that would fail?
$ uname -sr
Linux 2.2.12-20
$ ls -l /proc/self/cwd
lrwx------ 1 zefram zefram 0 Sep 17 13:17 /proc/self/cwd -> /home/zefram
$
Some other bits of /proc do this too. And on any system, a link could
be replaced between the lstat() and the readlink(). I think it would
be reasonable to use lstat() for a first guess, but we have to fall back
on an algorithm of increasing the buffer size until it's big enough.
-zefram
Messages sorted by:
Reverse Date,
Date,
Thread,
Author