focus-server: Apply umask(0) to change access permissions of its files 87/144987/2
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 21 Aug 2017 00:56:12 +0000 (09:56 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 21 Aug 2017 07:17:05 +0000 (16:17 +0900)
[Version] 0.11.18
[Issue Type] Enhancement

Change-Id: I7a46d3ea7df6cef23301175dccc5d6c4a553fecb
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
focus_server/mm_sound_focus_server.c
focus_server/mm_sound_mgr_focus_socket.c
packaging/libmm-sound.spec

index 42a98c0..6f32348 100644 (file)
@@ -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;
index bf12efa..4844106 100644 (file)
@@ -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)
index 58810c2..2744c54 100644 (file)
@@ -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