Mail Archives: djgpp-workers/2002/09/20/21:10:21
> > It looks like you may have missed the info in my posting below as rm.exe
> > from File Utilities 4.1 uses lstat and the change to fstat to produce
the
> > inodes is very simple to do for the majority of files as indicated below
as
> > well.
>
> Sorry, I didn't understand the change you propose. Can you show a
> patch or the new code?
Fist cut at the patch. This may not work for all cases, but it is a very
simple and small change to the code that fixes up some of the problems with
fstat.
*** fstatold.c Sat Sep 21 10:58:18 2002
--- fstat.c Sat Sep 21 11:01:32 2002
***************
*** 379,384 ****
--- 379,386 ----
unsigned short trusted_ftime = 0, trusted_fdate = 0;
long trusted_fsize = 0;
int is_link = 0;
+ const char *filename;
+ char fixed_filename[PATH_MAX + 1];
if ((dev_info = _get_dev_info(fhandle)) == -1)
return -1; /* errno set by _get_dev_info() */
***************
*** 395,400 ****
--- 397,403 ----
/* Initialize buffers. */
memset(stat_buf, 0, sizeof(struct stat));
+ memset(fixed_filename,0,sizeof(fixed_filename));
dos_ftime = 0;
/* Get some info about this handle by conventional DOS calls. These
***************
*** 436,443 ****
#ifndef NO_ST_BLKSIZE
if (__get_fd_name(fhandle))
{
- const char *filename;
- char fixed_filename[PATH_MAX + 1];
filename = __get_fd_name(fhandle);
_fixpath(filename, fixed_filename);
--- 439,444 ----
***************
*** 808,814 ****
if ( (_djstat_flags & _STAT_INODE) == 0 )
{
_djstat_fail_bits |= _STFAIL_HASH;
! stat_buf->st_ino = _invent_inode("", dos_ftime,
trusted_fsize);
}
if (trusted_fsize == 510)
--- 809,816 ----
if ( (_djstat_flags & _STAT_INODE) == 0 )
{
_djstat_fail_bits |= _STFAIL_HASH;
! /* fixed_filename may be either the filename or NULL */
! stat_buf->st_ino = _invent_inode(fixed_filename, dos_ftime,
trusted_fsize);
}
if (trusted_fsize == 510)
- Raw text -