data urls and FileCopyJob

David Faure dfaure at klaralvdalens-datakonsult.se
Sun Sep 14 22:27:25 BST 2003


On Sunday 14 September 2003 23:00, Leo Savernik wrote:
> Hello,
> 
> Data urls again. This time it is a problem with kwrite whose document stems
> from a data url.
> 
> I issue it with
> 
> kwrite "data:,bla."
> 
> and expect to get a document that contains nothing but
> 
> bla.
> 
> What I get is the following error message
> 
> Could not write to file /tmp/kde-kderun/kwriteG1vvrc.tmp

The debug output from kio_file says:
kio_file: Put /home/dfaure/.kde/tmp-Asterix/kwriteeCgaMa.tmp
kio_file: WARNING: Error when closing file descriptor:Bad file descriptor

This is a bug in kio_file, it tries to close(fd) even when fd==-1 due to
no data received. Please find the fix below (Waldo - ok?)

But this means the bug is that the data ioslave doesn't send any data...
or something in readData fails.

Index: file.cc
===================================================================
RCS file: /home/kde/kdelibs/kioslave/file/file.cc,v
retrieving revision 1.141
diff -u -p -r1.141 file.cc
--- file.cc     10 Sep 2003 00:12:17 -0000      1.141
+++ file.cc     14 Sep 2003 21:26:09 -0000
@@ -426,6 +426,12 @@ void FileProtocol::put( const KURL& url,
         ::exit(255);
     }

+    if ( fd == -1 ) // we got nothing to write out, so we never opened the file
+    {
+        finished();
+        return;
+    }
+
     if ( close(fd) )
     {
         kdWarning(7101) << "Error when closing file descriptor:" << strerror(errno) << endl;

-- 
David Faure -- faure at kde.org, dfaure at klaralvdalens-datakonsult.se
Qt/KDE/KOffice developer
Klarälvdalens Datakonsult AB, Platform-independent software solutions




More information about the kfm-devel mailing list