Revert "fix overflow"
authorSeonah Moon <seonah1.moon@samsung.com>
Fri, 3 Apr 2020 04:35:06 +0000 (13:35 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Fri, 3 Apr 2020 04:35:06 +0000 (13:35 +0900)
This reverts commit dd933cc386126b5debdf2f8a257cb831305e00d8.

test/wifi-aware-publish-test.c

index 6282269..56ed815 100644 (file)
@@ -587,12 +587,16 @@ static gboolean __test_terminal_read_std_input(GIOChannel * source,
 
        errno = 0;
        n = read(fd, buf, 1024);
-       if (n - 1 > 0 && n - 1 < 1024) {
+       if (n == 0) {
+               printf("Error: read() from stdin returns 0.\n");
+       } else if (n < 0) {
+               printf("input: read, err\n");
+       } else if (n - 1 > 0 && n < 1024) {
                buf[n - 1] = '\0'; /* remove new line... */
                printf("\n\n");
                __process_input(buf, user_data);
        } else {
-               printf("read error\n");
+               printf("invalid input\n");
        }
 
        return TRUE;