Mercurial > hg > xemacs-beta
changeset 1529:d4c017f833e2
[xemacs-hg @ 2003-06-15 13:25:46 by adrian]
[A21.5R21.4] [PATCH] xemacs-21.5: minitar.c to handle 0 size files
-------------------- ChangeLog entries follow: --------------------
nt/ChangeLog addition:
2003-06-15 Adrian Aichner <adrian@xemacs.org>
* minitar.c (main): Handle 0 size files correctly.
author | adrian |
---|---|
date | Sun, 15 Jun 2003 13:25:46 +0000 |
parents | 16bd99a7ef3c |
children | 7843c9f39049 |
files | nt/ChangeLog nt/minitar.c |
diffstat | 2 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/nt/ChangeLog Sat Jun 14 21:52:18 2003 +0000 +++ b/nt/ChangeLog Sun Jun 15 13:25:46 2003 +0000 @@ -1,3 +1,7 @@ +2003-06-15 Adrian Aichner <adrian@xemacs.org> + + * minitar.c (main): Handle 0 size files correctly. + 2003-06-01 Steve Youngs <youngs@xemacs.org> * XEmacs 21.5.14 "cassava" is released.
--- a/nt/minitar.c Sat Jun 14 21:52:18 2003 +0000 +++ b/nt/minitar.c Sun Jun 15 13:25:46 2003 +0000 @@ -139,6 +139,7 @@ { fprintf (stderr, "Error: incorrect magic number in tar header. Exiting\n"); + exit (-2); } strncpy (name, block, 100); @@ -158,6 +159,7 @@ break; default: fprintf (stderr, "Error: unknown type flag %c. Exiting.\n", type); + exit (-2); break; } @@ -218,6 +220,8 @@ fprintf (stderr, "Error: invalid size in tar header. Exiting.\n"); exit (-2); } + if (size==0) /* file of size 0 is done */ + in_block = 0; } } else { /* write or continue writing file contents */ nbytes = size>512? 512:size; @@ -227,6 +231,7 @@ { fprintf (stderr, "Error: only wrote %d bytes to file %s. Exiting.\n", nwritten, fullname); + exit (-2); } size -= nbytes; if (size==0)