From 9b324b65f4aae8f7e4b182df59da625aa751e800 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 24 May 2008 00:10:07 +0000 Subject: commit half-baked sound theme spec implementaiton git-svn-id: file:///home/lennart/svn/public/libcanberra/trunk@7 01b60673-d06a-42c0-afdd-89cb8e0f78ac --- read-sound-file.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'read-sound-file.c') 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; -- cgit