bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8401: removing duplication and improving the readlink code


From: Eli Zaretskii
Subject: bug#8401: removing duplication and improving the readlink code
Date: Fri, 01 Apr 2011 11:33:37 +0300

> Date: Thu, 31 Mar 2011 23:47:14 -0700
> From: Paul Eggert <address@hidden>
> CC: Eli Zaretskii <address@hidden>
> 
> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]