From kfm-devel Sat Jul 24 16:45:28 1999 From: Matt Koss Date: Sat, 24 Jul 1999 16:45:28 +0000 To: kfm-devel Subject: Re: Kio_file & Rollback X-MARC-Message: https://marc.info/?l=kfm-devel&m=93283491806459 On Fri, 23 Jul 1999, Dawit Alemayehu wrote: >On Fri, 23 Jul 1999, Waldo Bastian wrote: >> Matt Koss wrote: >> > >> > I want to implement rollback in kio_file. >> > This means, that when the transfer is interrupted, slave will take some bytes >> > from the end of the file and put them away. >> > Later, when resumed, this will make sure that there is not any trailing garbage. >> > >> > But what's the easiest thing to achieve it ? >> > >> > Is there some simple method for cutting some data from the end of the local >> > file ? >> >> Yes. truncate() is your friend. Not sure if it is defined by POSIX. >> See your local man page. > >truncate() is not defined by POSIX, at least not according to my Linux man >pages. Also wouldn't you loose the whole file if you use truncate() ?? I >thought truncate simply changed the size to the specified length. If so, I >don't think this is what Matt is looking for. He just wants to save off some >bytes from the end of the original file, without damaging it ( this will become >the *.part file IIRC ) if transfer is interrupted. Basically, what I have to do is : 1. truncate file, which will cut the garbage from the end of file 2. later, when resuming, compare some data from the end of the truncated file with a data read by resumed transfer. If they match = http server supports resuming Thanks Matt > >Regards, >Dawit A. -- Matej Koss e-mail: koss@napri.sk Kosice ICQ# : 19344305 Slovakia