[FIX] app launch timer if attaching to running app
authorNikita Kalyazin <n.kalyazin@samsung.com>
Thu, 28 Nov 2013 05:51:44 +0000 (09:51 +0400)
committerNikita Kalyazin <n.kalyazin@samsung.com>
Thu, 28 Nov 2013 13:06:07 +0000 (17:06 +0400)
Apps count _may_ be equal to 0 (if we are attaching to an app, not
launching one).
Also assert for apps count >= 0 added.

Change-Id: Ia24f2856e4240b5e827026713f613238b36a870a
Signed-off-by: Nikita Kalyazin <n.kalyazin@samsung.com>
daemon/daemon.c

index d6ce4628586e61336d2a8ea6b14c89b2f3682c40..4cc569a06ebe028db4b978c1bbb3ba82ea9ce671 100644 (file)
@@ -53,6 +53,9 @@
 #include <linux/input.h>
 #include <dirent.h>
 #include <fcntl.h>
+
+#include <assert.h>
+
 #include "daemon.h"
 #include "sys_stat.h"
 #include "utils.h"
@@ -246,11 +249,10 @@ static int start_app_launch_timer(int apps_count)
        int res = 0;
        struct epoll_event ev;
 
-       if (apps_count <= 0) {
-               res = -1;
-               LOGE("Wrong apps_count!\n");
+       assert(apps_count >= 0 && "negative apps count");
+
+       if (apps_count == 0)
                return res;
-       }
 
        manager.app_launch_timerfd =
            timerfd_create(CLOCK_REALTIME, TFD_CLOEXEC);