diff src/audacious/vfs_buffered_file.c @ 2589:ea470384e752 trunk

[svn] - add vfs_buffered_file_release_live_fd().
author nenolod
date Tue, 27 Feb 2007 04:09:06 -0800
parents c51a5a735f65
children 06e4bbdb6c45
line wrap: on
line diff
--- a/src/audacious/vfs_buffered_file.c	Tue Feb 27 03:49:22 2007 -0800
+++ b/src/audacious/vfs_buffered_file.c	Tue Feb 27 04:09:06 2007 -0800
@@ -38,7 +38,9 @@
     {
         VFSBufferedFile *handle = (VFSBufferedFile *) file->handle;
 
-        vfs_fclose(handle->fd);
+        if (handle->fd != NULL)
+            vfs_fclose(handle->fd);
+
         vfs_fclose(handle->buffer);
         g_free(handle->mem);
         g_free(handle);
@@ -222,3 +224,18 @@
     return handle;
 }
 
+VFSFile *
+vfs_buffered_file_release_live_fd(VFSFile *fd)
+{
+    VFSBufferedFile *file = (VFSBufferedFile *) fd;
+    VFSFile *out;
+
+    g_return_val_if_fail(file != NULL, NULL);
+
+    out = file->fd;
+    file->fd = NULL;
+
+    vfs_fclose(fd);
+
+    return out;
+}