delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/09/20/21:10:21

Message-ID: <002901c2610a$ecb8daa0$0100a8c0@p4>
From: "Andrew Cottrell" <acottrel AT ihug DOT com DOT au>
To: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Cc: <sandmann AT clio DOT rice DOT edu>, <rich AT phekda DOT freeserve DOT co DOT uk>,
<djgpp-workers AT delorie DOT com>
References: <002301c25fc3$62fc2b70$0100a8c0 AT p4> <4634-Sat21Sep2002003332+0300-eliz AT is DOT elta DOT co DOT il>
Subject: Re: Fw: Two rm.exe issues on XP
Date: Sat, 21 Sep 2002 11:04:35 +1000
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Reply-To: djgpp-workers AT delorie DOT com

> > 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019