From: Sangchul Lee Date: Mon, 21 Aug 2017 00:56:12 +0000 (+0900) Subject: focus-server: Apply umask(0) to change access permissions of its files X-Git-Tag: accepted/tizen/unified/20170822.023847~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F87%2F144987%2F2;p=platform%2Fcore%2Fmultimedia%2Flibmm-sound.git focus-server: Apply umask(0) to change access permissions of its files [Version] 0.11.18 [Issue Type] Enhancement Change-Id: I7a46d3ea7df6cef23301175dccc5d6c4a553fecb Signed-off-by: Sangchul Lee --- diff --git a/focus_server/mm_sound_focus_server.c b/focus_server/mm_sound_focus_server.c index 42a98c0..6f32348 100644 --- a/focus_server/mm_sound_focus_server.c +++ b/focus_server/mm_sound_focus_server.c @@ -266,6 +266,9 @@ int main(int argc, char **argv) } #endif if (serveropt.startserver) { + /* Change the file mode mask */ + umask(0); + if (MMSoundMgrFocusSocketInit(&socket_fd)) { debug_error("focus_server [%d] terminating, due to the error of socket init.", getpid()); return 0; diff --git a/focus_server/mm_sound_mgr_focus_socket.c b/focus_server/mm_sound_mgr_focus_socket.c index bf12efa..4844106 100644 --- a/focus_server/mm_sound_mgr_focus_socket.c +++ b/focus_server/mm_sound_mgr_focus_socket.c @@ -212,7 +212,7 @@ int MMSoundMgrFocusSocketInit(int *fd) if (socket_fd < 0) { strerror_r(errno, str_error, sizeof(str_error)); debug_error("failed to socket(), err: %s", str_error); - return MM_ERROR_SOUND_INTERNAL; + goto LEAVE; } debug_log("focus server socket fd [%d]", socket_fd); @@ -230,12 +230,10 @@ int MMSoundMgrFocusSocketInit(int *fd) if (bind(socket_fd, (struct sockaddr *)&addr_un, sizeof(addr_un))) { strerror_r(errno, str_error, sizeof(str_error)); debug_error("failed to bind() again, err: %s", str_error); - close(socket_fd); - return MM_ERROR_SOUND_INTERNAL; + goto LEAVE; } } else { - close(socket_fd); - return MM_ERROR_SOUND_INTERNAL; + goto LEAVE; } } @@ -246,6 +244,12 @@ int MMSoundMgrFocusSocketInit(int *fd) debug_leave(); return MM_ERROR_NONE; + +LEAVE: + if (socket_fd >= 0) + close(socket_fd); + + return MM_ERROR_SOUND_INTERNAL; } void MMSoundMgrFocusSocketFini(int fd) diff --git a/packaging/libmm-sound.spec b/packaging/libmm-sound.spec index 58810c2..2744c54 100644 --- a/packaging/libmm-sound.spec +++ b/packaging/libmm-sound.spec @@ -1,6 +1,6 @@ Name: libmm-sound Summary: MMSound Package contains client lib and sound_server binary -Version: 0.11.17 +Version: 0.11.18 Release: 0 Group: System/Libraries License: Apache-2.0