zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <zefram@fysh.org>
To: Bart Schaefer <schaefer@candle.brasslantern.com>
Cc: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: zasprintf
Date: Sun, 17 Sep 2000 13:21:23 +0100 (BST)	[thread overview]
Message-ID: <E13adRj-0001rU-00@crucigera.fysh.org> (raw)
In-Reply-To: <1000917004721.ZM18698@candle.brasslantern.com> from Bart Schaefer at "Sep 17, 2000 00:47:20 am"

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


  parent reply	other threads:[~2000-09-17 12:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-16 18:53 Clint Adams
2000-09-17  0:47 ` Bart Schaefer
2000-09-17  1:10   ` PATH_MAX again Bart Schaefer
2000-09-17  4:25   ` PATCH: zasprintf Clint Adams
2000-09-17  5:37     ` Bart Schaefer
2000-09-17 15:04       ` Clint Adams
2000-09-17 16:13         ` Bart Schaefer
2000-09-17 16:43           ` Clint Adams
2000-09-17 12:21   ` Zefram [this message]
2000-09-18 13:28 ` Andrej Borsenkow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E13adRj-0001rU-00@crucigera.fysh.org \
    --to=zefram@fysh.org \
    --cc=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).