Mail Archives: djgpp-workers/1999/08/22/14:14:34
Attached below is my patch for djtar.c (made against the latest CVS
version: 12662 Jun 3 12:27 djtar.c), to prevent an empty `tarchange.lst'
file from being left behind if no name changes are made during file
extraction.
I added a counter (`n_changes') and increment it every time a new
change entry is requested. At the end, a change file is written only
if n_changes > 0. I did all my testing on a SFN system; someone with
an LFN setup might want to make a quick check just for completeness.
jtw
*** djtar.c Thu Jun 3 12:27:41 1999
--- djtar.c.new Sun Aug 22 11:15:18 1999
***************
*** 99,104 ****
--- 99,105 ----
FILE *change_file;
+ int n_changes = 0;
int v_switch = 0;
int dot_switch = 1;
int text_unix = 0;
***************
*** 167,172 ****
--- 168,174 ----
ch = (CHANGE *)malloc(sizeof(CHANGE));
if (ch == 0)
Fatal("Out of memory");
+ n_changes++;
ch->next = change_root;
change_root = ch;
ch->old = strdup(fname);
***************
*** 547,553 ****
setmode(fileno(stdout), O_TEXT);
return 0;
}
! else
{
change_file = fopen("tarchange.lst", "w");
if (change_file != (FILE *)0)
--- 549,555 ----
setmode(fileno(stdout), O_TEXT);
return 0;
}
! else if (n_changes)
{
change_file = fopen("tarchange.lst", "w");
if (change_file != (FILE *)0)
***************
*** 559,562 ****
--- 561,566 ----
else
return 1;
}
+ else
+ return 0;
}
- Raw text -