Move volume vconf set to pulseaudio
[platform/core/multimedia/libmm-sound.git] / mm_sound_bootsound.c
index 043edee..0f5a129 100644 (file)
 #include <memory.h>
 #include <unistd.h>
 #include <pthread.h>
-#include <stdio.h>
-#include <sys/types.h>
 #include <fcntl.h>
 #include <vconf.h>
 
-#include <sys/stat.h>
-#include <errno.h>
-
 #include <semaphore.h>
-#include <errno.h>
 
-#include <mm_types.h>
 #include <mm_error.h>
-#include <mm_message.h>
 #include <mm_debug.h>
-#include <mm_sound.h>
-#include <mm_sound_private.h>
 
 #define KEYTONE_PATH        "/tmp/keytone"  /* Keytone pipe path */
 #define FILE_FULL_PATH 1024                            /* File path lenth */
@@ -58,7 +48,7 @@ typedef struct {
 #define MMSOUND_STRNCPY(dst,src,size)\
 do { \
        if(src != NULL && dst != NULL && size > 0) {\
-               strncpy(dst,src,size); \
+               strncpy(dst,src,size-1); \
                dst[size-1] = '\0';\
        } else if(dst == NULL) {       \
                debug_error("STRNCPY ERROR: Destination String is NULL\n"); \
@@ -113,7 +103,9 @@ int mm_sound_boot_play_sound(char* path)
        /* Check whether file exists */
        fd = open(path, O_RDONLY);
        if (fd == -1) {
-               debug_error("file open failed with [%s][%d]\n", strerror(errno), errno);
+               char str_error[256];
+               strerror_r(errno, str_error, sizeof(str_error));
+               debug_error("file open failed with [%s][%d]\n", str_error, errno);
                switch (errno) {
                case ENOENT:
                        return MM_ERROR_SOUND_FILE_NOT_FOUND;
@@ -141,7 +133,9 @@ int mm_sound_boot_play_sound(char* path)
        /* Write to PIPE */
        err = write(fd, &data, size);
        if (err < 0) {
-               debug_error("Fail to write data: [%s][%d]\n", strerror(errno), errno);
+               char str_error[256];
+               strerror_r(errno, str_error, sizeof(str_error));
+               debug_error("Fail to write data: [%s][%d]\n", str_error, errno);
                close(fd);
                return MM_ERROR_SOUND_INTERNAL;
        }