[lokisetup] copy of 1 byte long file fails

Ludwig Nussel ludwig.nussel at gmx.de
Wed Dec 8 14:35:07 EST 2004


dams wrote:
> When using the File command to copy a file from the cd to the hard 
> drive, we have the following problem : if the file contains only one 
> byte (size of the file : 1 byte), equal to zero, the file copied is 
> emtpy (size of the file : 0 byte)
> 
> That's somehow problematic, we wrote a small script that overwrites the 
> files by doing printf "\0" > the_file  (something like that), but it's 
> not really fun.

Interesting bug :-) Try this (untested):

Index: file.c
===================================================================
RCS file: /cvs/cvsroot/loki_setup/file.c,v
retrieving revision 1.42
diff -u -r1.42 file.c
--- file.c	10 Nov 2004 22:26:08 -0000	1.42
+++ file.c	8 Dec 2004 19:32:43 -0000
@@ -218,7 +218,9 @@
 				fstat(fileno(streamp->fp), &st);
 				streamp->size = st.st_size;
             }
-        }
+		} else {
+			rewind(streamp->fp);
+		}
         if ( (streamp->fp == NULL) && (streamp->zfp == NULL) && (streamp->bzfp == NULL) ) {
             file_close(info, streamp);
             log_warning(_("Couldn't read from file: %s"), path);

cu
Ludwig

-- 
(o_  Ludwig.Nussel at gmx.de
//\
V_/_ PGP Key ID: FF8135CE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://icculus.org/pipermail/lokisetup/attachments/20041208/922af76b/attachment.pgp>


More information about the Lokisetup mailing list