summaryrefslogtreecommitdiffstats
path: root/read-sound-file.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-05-24 00:10:07 +0000
committerLennart Poettering <lennart@poettering.net>2008-05-24 00:10:07 +0000
commit9b324b65f4aae8f7e4b182df59da625aa751e800 (patch)
tree1cb08f8e7a26a85a2886d395c47952891c9752dc /read-sound-file.c
parent3f00b1697f7304bb565232f5378ec38a23e12649 (diff)
commit half-baked sound theme spec implementaiton
git-svn-id: file:///home/lennart/svn/public/libcanberra/trunk@7 01b60673-d06a-42c0-afdd-89cb8e0f78ac
Diffstat (limited to 'read-sound-file.c')
-rw-r--r--read-sound-file.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/read-sound-file.c b/read-sound-file.c
index 37d0dd1..13066b1 100644
--- a/read-sound-file.c
+++ b/read-sound-file.c
@@ -25,6 +25,7 @@
struct ca_sound_file {
ca_wav *wav;
ca_vorbis *vorbis;
+ char *filename;
unsigned nchannels;
unsigned rate;
@@ -42,8 +43,13 @@ int ca_sound_file_open(ca_sound_file *_f, const char *fn) {
if (!(f = ca_new0(ca_sound_file, 1)))
return CA_ERROR_OOM;
+ if (!(f->filename = ca_strdup(fn))) {
+ ret = CA_ERROR_OOM;
+ goto fail;
+ }
+
if (!(file = fopen(fn, "r"))) {
- ret = CA_ERROR_SYSTEM;
+ ret = errno == ENOENT ? CA_ERROR_NOTFOUND : CA_ERROR_SYSTEM;
goto fail;
}
@@ -72,6 +78,8 @@ int ca_sound_file_open(ca_sound_file *_f, const char *fn) {
}
fail:
+
+ ca_free(f->filename);
ca_free(f);
return ret;