www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/07/12/12:55:45

Date: Sun, 12 Jul 1998 19:54:32 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: DJ Delorie <dj AT delorie DOT com>
cc: djgpp-workers AT delorie DOT com
Subject: DJGPP alpha 980710 (part 3)
Message-ID: <Pine.SUN.3.91.980712194826.27114d-100000@is>
MIME-Version: 1.0

This patch to djtar didn't make it into the latest alpha.  Since DJ said 
that we don't know what the bug is, here's a recap:

The problem is that djtar doesn't check whether a rename succeeded.  If 
the user renamed a directory (because the original name didn't work), the 
rename rule is recorded and used thereafter unconditionally.

But a full disk might prevent the rename from working (since there's no 
place to create a directory by *any* name).  In this case, djtar will 
repeatedly try to rename the files automatically, by appending each new 
name to the previous one, eventually running out of space in a character 
array that's allocated for the name.

This simple change stops that avalanche by preventing djtar from using a 
rename rule which didn't work.

*** src/utils/djtar/djtar.c	Sun Jun 28 23:30:02 1998
--- ../alpha0/src/utils/djtar/djtar.c	Fri May 22 20:38:34 1998
***************
*** 1,4 ****
- /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
--- 1,3 ----
*************** change(char *fname, const char *problem,
*** 139,145 ****
    char *pos;
  
    for (ch=change_root; ch; ch = ch->next)
!     if ((strncmp(fname, ch->old, strlen(ch->old)) == 0) && ch->isdir)
      {
        if (ch->isdir == 2)
        {
--- 138,146 ----
    char *pos;
  
    for (ch=change_root; ch; ch = ch->next)
!     if ((strncmp(fname, ch->old, strlen(ch->old)) == 0) && ch->isdir
! 	/* Don't use change rules which failed to work before.  */
! 	&& access(ch->new, D_OK) == 0)
      {
        if (ch->isdir == 2)
        {

- Raw text -


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