EMILE/libstream/stream_close.c

25 lines
439 B
C
Raw Normal View History

2005-11-21 23:55:56 +00:00
/*
*
* (c) 2005 Laurent Vivier <Laurent@lvivier.info>
2005-11-21 23:55:56 +00:00
*
*/
#include <stdlib.h>
#include "libstream.h"
int stream_close(stream_t *stream)
{
if (stream->fs.close &&
stream->fs.close(stream->fs.file) != 0)
2005-11-21 23:55:56 +00:00
return -1;
if (stream->fs.umount &&
stream->fs.umount(stream->fs.volume) != 0)
2005-11-21 23:55:56 +00:00
return -1;
if (stream->device.close &&
stream->device.close(stream->device.data) != 0)
2005-11-21 23:55:56 +00:00
return -1;
free(stream);
return 0;
}