From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: bug-gnu-emacs@gnu.org
Subject: bug#8401: removing duplication and improving the readlink code
Date: Fri, 01 Apr 2011 11:33:37 +0300 [thread overview]
Message-ID: <83vcyypdzy.fsf@gnu.org> (raw)
In-Reply-To: <4D9574F2.20108@cs.ucla.edu>
> Date: Thu, 31 Mar 2011 23:47:14 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: Eli Zaretskii <eliz@gnu.org>
>
> In two places Emacs calls readlink with similar code to reallocate
> buffers until there's enough room to store the symbolic link's value.
> And in both places there are minor problems with overflow, since Emacs
> uses 32-bit int where modern 64-bit systems use 64-bit ssize_t, and it
> doesn't check for overflow in buffer size calculations. These
> problems cause GCC to complain, if warnings are enabled. I plan to
> fix the problems with the following patch, which substitutes a gnulib
> implementation of the same basic readlink idea; this implementation
> does more-careful buffer size checking, and makes it possible to
> avoid the malloc+free in the usual case.
Isn't much easier and much more elegant to use ssize_t instead of an
int for the buffer sizes in both cases?
> This patch adds a couple of dependencies so it may affect the
> Windows build.
If this patch is accepted, the new emacs_readlink function will be a
trivial "fail" stub on Windows. I don't see a need to compile in all
this gnulib code just to return NULL because readlink always fails.
next prev parent reply other threads:[~2011-04-01 8:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-01 6:47 bug#8401: removing duplication and improving the readlink code Paul Eggert
2011-04-01 8:33 ` Eli Zaretskii [this message]
2011-04-01 19:00 ` Paul Eggert
2011-04-01 19:38 ` Eli Zaretskii
2011-04-01 20:09 ` Paul Eggert
2011-04-01 20:57 ` Eli Zaretskii
2011-04-02 1:57 ` Paul Eggert
2011-04-03 16:41 ` Stefan Monnier
2011-04-04 4:38 ` Paul Eggert
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=83vcyypdzy.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=bug-gnu-emacs@gnu.org \
--cc=eggert@cs.ucla.edu \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.