enlightenment_info: add argument count checking of dump_buffers 56/67056/5
authorJunkyeong Kim <jk0430.kim@samsung.com>
Mon, 25 Apr 2016 02:40:56 +0000 (11:40 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 25 Apr 2016 02:59:06 +0000 (19:59 -0700)
Change-Id: Ie613dc3a1df3dac5986b6acf77e40dff754d8f31
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
src/bin/e_info_client.c

index 1e6b033eca450b696968a3b1b92b0d1c52a416a4..2ac53c6a2fdb579459464c9105368cdd447acc1e 100644 (file)
@@ -922,14 +922,27 @@ _e_info_client_proc_transform_set(int argc, char **argv)
 static void
 _e_info_client_proc_buffer_shot(int argc, char **argv)
 {
-   int dumprun = atoi(argv[2]);
+   if (argc == 3)
+     {
+        int dumprun = atoi(argv[2]);
+
+        if (dumprun < 0 || dumprun > 1)
+          {
+             printf("Error Check Args : enlightenment_info -dump_buffers [1: start, 0: stop]\n");
+             return;
+          }
 
-   if (!_e_info_client_eldbus_message_with_args("dump_buffers", NULL, "i", dumprun))
+        if (!_e_info_client_eldbus_message_with_args("dump_buffers", NULL, "i", dumprun))
+          {
+             printf("_e_info_client_proc_buffer_shot fail (%d)\n", dumprun);
+             return;
+          }
+        printf("_e_info_client_proc_buffer_shot %s\n", (dumprun == 1 ? "start" : "stop"));
+     }
+   else
      {
-        printf("_e_info_client_proc_buffer_shot fail (%d)\n", dumprun);
-        return;
+        printf("Error Check Args : enlightenment_info -dump_buffers [1: start, 0: stop]\n");
      }
-   printf("_e_info_client_proc_buffer_shot %s\n", (dumprun == 1 ? "start" : "stop"));
 }
 
 #ifdef HAVE_HWC