|
From: Julian S. <js...@ac...> - 2005-09-13 18:01:44
|
Re the below, shouldn't the 3rd arg to VG_(readlink) be n_buf?
J
/* Given a file descriptor, attempt to deduce its filename. To do
this, we use /proc/self/fd/<FD>. If this doesn't point to a file,
or if it doesn't exist, we return False. */
Bool VG_(resolve_filename) ( Int fd, HChar* buf, Int n_buf )
{
HChar tmp[64];
VG_(sprintf)(tmp, "/proc/self/fd/%d", fd);
VG_(memset)(buf, 0, n_buf);
if (VG_(readlink)(tmp, buf, VKI_PATH_MAX) > 0 && buf[0] == '/')
return True;
else
return False;
}
|
|
From: Nicholas N. <nj...@cs...> - 2005-09-13 18:14:41
|
On Tue, 13 Sep 2005, Julian Seward wrote:
> Re the below, shouldn't the 3rd arg to VG_(readlink) be n_buf?
>
>
> /* Given a file descriptor, attempt to deduce its filename. To do
> this, we use /proc/self/fd/<FD>. If this doesn't point to a file,
> or if it doesn't exist, we return False. */
> Bool VG_(resolve_filename) ( Int fd, HChar* buf, Int n_buf )
> {
> HChar tmp[64];
>
> VG_(sprintf)(tmp, "/proc/self/fd/%d", fd);
> VG_(memset)(buf, 0, n_buf);
>
> if (VG_(readlink)(tmp, buf, VKI_PATH_MAX) > 0 && buf[0] == '/')
> return True;
> else
> return False;
> }
I think so. It hasn't been a problem so far because all the callers pass
in VKI_PATH_MAX for n_buf. I see you've changed it anyway in ASPACEM,
seems fine.
N
|