Hi guys

I was trying to copy a folder containing a couple of thousand oggs to my
karma using riocp. About half the tracks were already on the karma, so I was
hoping they would be ignored, and the rest would be copied across.

This worked up to a point, but then riocp threw an error saying "Too many
open files".

It turns out that if lk_rio_do_write returns early (e.g. because the file is
already on the karma) then the file is not closed. If you're copying lots of
files, you'll soon end up with too many open file handles.

The attached patch fixes the problem.

Olly
diff -r ccd883275907 src/rio_rw.c
--- a/src/rio_rw.c	Wed Apr 11 02:57:14 2007 +0200
+++ b/src/rio_rw.c	Sat Apr 14 00:18:25 2007 +0100
@@ -362,7 +362,8 @@ static uint32_t lk_rio_do_write(int fdb,
             free(ids);
             lk_errors_set(E_DUPE);
             lk_properties_del_property(fid);
-	    return -1;
+			close(fd);
+			return -1;
 	}
     }
 
@@ -370,6 +371,7 @@ static uint32_t lk_rio_do_write(int fdb,
         if(lk_karma_write_file_chunk(rio, offs, got, fid, 0, tmp)!=0) {
 	    lk_errors_set(E_WRCHUNK);
             lk_properties_del_property(fid);
+			close(fd);
             return -1;
         }
         offs+=got;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-karma-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-karma-devel

Reply via email to