Fix code warning.
Change-Id: Ib11fb49f528d3688351ae349d5b4e307c28b3967
diff --git a/mbtk/mbtk_utils/at.c b/mbtk/mbtk_utils/at.c
index 950d3e2..1e8f91b 100755
--- a/mbtk/mbtk_utils/at.c
+++ b/mbtk/mbtk_utils/at.c
@@ -11,9 +11,11 @@
#include <netinet/in.h>
#include <signal.h>
#include <unistd.h>
+#include <pthread.h>
#include <sys/select.h>
#include "mbtk_type.h"
+#include "mbtk_utils.h"
//#define AT_TYPE_SOCKET
#define MBTK_LOG
@@ -39,8 +41,8 @@
AT_MODE_DEV_2
} at_mode_enum;
-static int epoll_fd = -1;
-static struct epoll_event epoll_events[20];
+// static int epoll_fd = -1;
+// static struct epoll_event epoll_events[20];
static int at_fd = -1;
static at_mode_enum at_mode = AT_MODE_SOCK_1;
@@ -54,15 +56,16 @@
"NO DIALTONE",
NULL};
-//#ifdef AT_TYPE_SOCKET
+#ifndef TEMP_FAILURE_RETRY
#define TEMP_FAILURE_RETRY(exp) ({ \
typeof (exp) _rc; \
do { \
_rc = (exp); \
} while (_rc == -1 && errno == EINTR); \
_rc; })
-//#endif
+#endif
+#if 0
static void at_epoll_change(int is_add,int fd)
{
struct epoll_event ev;
@@ -95,6 +98,7 @@
return 0;
}
+#endif
//#ifdef AT_TYPE_SOCKET
int openSocket(const char* sockname)
@@ -349,7 +353,7 @@
pthread_attr_t attr;
pthread_attr_init (&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- int ret = pthread_create(&tid, &attr, read_thread_run, &attr);
+ int ret = pthread_create(&tid, &attr, read_thread_run, NULL);
if (ret < 0)
{
LOGE("pthread_create\n");
@@ -595,10 +599,10 @@
memset(write_buff, 0x0, 1024);
printf("%s\n", read_buff);
len = snprintf(write_buff, 1024, "%s\n", read_buff);
- write(at_fd, write_buff, len);
+ mbtk_write(at_fd, write_buff, len);
} else {
printf("Read error:%d\n",errno);
- return NULL;
+ return -1;
}
}
#endif