diff options
author | Seungbae Shin <seungbae.shin@samsung.com> | 2012-02-09 18:29:09 +0900 |
---|---|---|
committer | Seungbae Shin <seungbae.shin@samsung.com> | 2012-02-09 18:29:09 +0900 |
commit | 8f337116f8d6434479f4833f48dec430198cc69f (patch) | |
tree | 7345bf58f40cc4517c78f835caac545d963ac8f7 /mm_sound_keysound.c | |
parent | ec7fd09612e09df3e76eed96af42446c07aae7fd (diff) | |
download | libmm-sound-8f337116f8d6434479f4833f48dec430198cc69f.tar.gz libmm-sound-8f337116f8d6434479f4833f48dec430198cc69f.tar.bz2 libmm-sound-8f337116f8d6434479f4833f48dec430198cc69f.zip |
update to latest
Diffstat (limited to 'mm_sound_keysound.c')
-rw-r--r-- | mm_sound_keysound.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/mm_sound_keysound.c b/mm_sound_keysound.c index d2c2056..0d7bf9f 100644 --- a/mm_sound_keysound.c +++ b/mm_sound_keysound.c @@ -52,12 +52,14 @@ int mm_sound_play_keysound(const char *filename, const volume_type_t vol_type) int size = 0; ipc_t data = {{0,},}; + debug_fenter(); + if(!filename) return MM_ERROR_SOUND_INVALID_FILE; + /* Check whether file exists */ fd = open(filename, O_RDONLY); - if(fd == -1) - { + if(fd == -1) { debug_error("file open failed with %s\n", strerror(errno)); switch(errno) { @@ -70,27 +72,28 @@ int mm_sound_play_keysound(const char *filename, const volume_type_t vol_type) return MM_ERROR_SOUND_INTERNAL; } } - close(fd); fd = -1; + close(fd); + fd = -1; + /* Open PIPE */ fd = open(KEYTONE_PATH, O_WRONLY | O_NONBLOCK); - if (fd == -1) - { + if (fd == -1) { debug_error("Fail to open pipe\n"); return MM_ERROR_SOUND_FILE_NOT_FOUND; } data.vol_type = vol_type; - strncpy(data.filename, filename, FILE_FULL_PATH); debug_msg("The file name [%s]\n", data.filename); size = sizeof(ipc_t); + + /* Write to PIPE */ err = write(fd, &data, size); - if(err<0) - { + if(err < 0) { debug_error("Fail to write data: %s\n", strerror(err)); close(fd); return MM_ERROR_SOUND_INTERNAL; - } + /* Close PIPE */ close(fd); debug_fleave(); |