From: shingil.kang Date: Fri, 21 Mar 2014 07:51:24 +0000 (+0900) Subject: SDB: Fixed prevent issue X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ead476e3365c65d2629de114e30864b0443a023;p=sdk%2Ftools%2Fsdb.git SDB: Fixed prevent issue Checked return value Change-Id: I652833172ee798bc28fdbbe7c0ee885c0f72e8d7 Signed-off-by: shingil.kang --- diff --git a/src/fdevent.c b/src/fdevent.c index 1b23844..fbaf954 100755 --- a/src/fdevent.c +++ b/src/fdevent.c @@ -91,7 +91,9 @@ void fdevent_install(FD_EVENT *fde, int fd, fd_func func, void *arg) fde->events = 0; #ifndef OS_WINDOWS - fcntl(fd, F_SETFL, O_NONBLOCK); + int ret = fcntl(fd, F_SETFL, O_NONBLOCK); + if(ret == -1) + fprintf(stderr, "fail to set the file status flag\n"); if(fd >= max_select) { max_select = fd + 1; } diff --git a/src/transport.c b/src/transport.c index d5e691c..8e771a0 100755 --- a/src/transport.c +++ b/src/transport.c @@ -750,7 +750,10 @@ static int check_data(PACKET *p) void wakeup_select_func(int _fd, unsigned ev, void *data) { T_PACKET* t_packet = NULL; - readx(_fd, &t_packet, sizeof(t_packet)); + int length = readx(_fd, &t_packet, sizeof(t_packet)); + if(length == -1) { + LOG_DEBUG("wakeup_select_func(): cannot read FD(%d) transport packet", _fd); + } TRANSPORT* t= t_packet->t; D("T(%s)\n", t->serial); diff --git a/src/usb_linux.c b/src/usb_linux.c index 6a73663..fcba4e8 100644 --- a/src/usb_linux.c +++ b/src/usb_linux.c @@ -454,7 +454,9 @@ static int usb_urb_transfer(usb_handle *h, int ep, char *bytes, int size, * then we need to reap it or else the next time we call this function, * we'll get the previous completion and exit early */ - ioctl(h->node_fd, USBDEVFS_REAPURB, &context); + ret = ioctl(h->node_fd, USBDEVFS_REAPURB, &context); + if (ret < 0 && errno != EINVAL) + LOG_DEBUG("error reaping URB: %s\n", strerror(errno)); return rc; } diff --git a/src/utils_unix.c b/src/utils_unix.c index 3ae9d3b..aec8ad9 100755 --- a/src/utils_unix.c +++ b/src/utils_unix.c @@ -144,7 +144,9 @@ static char* _ansi_to_utf8(const char *str) static void _close_on_exec(int fd) { - fcntl( fd, F_SETFD, FD_CLOEXEC ); + int ret = fcntl( fd, F_SETFD, FD_CLOEXEC ); + if (ret == -1) + fprintf(stderr, "fail to set the file descriptor to be closed when the process executes another program\n"); } static int _sdb_open( const char* pathname, int options ) @@ -249,7 +251,9 @@ static int _sdb_socket_setbufsize( int fd, int bufsize ) static void _disable_tcp_nagle(int fd) { int on = 1; - setsockopt( fd, IPPROTO_TCP, TCP_NODELAY, (void*)&on, sizeof(on) ); + int ret = setsockopt( fd, IPPROTO_TCP, TCP_NODELAY, (void*)&on, sizeof(on) ); + if (ret == -1) + fprintf(stderr, "fail to set level option of FD(%d)", fd); } static int _sdb_thread_create( sdb_thread_t *pthread, sdb_thread_func_t start, void* arg ) @@ -338,7 +342,9 @@ static int _sdb_port_listen(uint32_t inet, int port, int type) } n = 1; - setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n)); + int ret = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n)); + if (ret == -1) + fprintf(stderr, "fail to set level option of FD(%d)", s); if(bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { sdb_close(s);