- D("about to read (fd=%d, len=%zu)\n", h->fd, len);
- while (len > 0) {
- /* The sdb_read does not support read larger than 4096 bytes at once.
- Read 4096 byte block repeatedly when reading data is larger than 4096 bytes. */
- int bytes_to_read = len < 4096 ? len : 4096;
- int n = sdb_read(h->fd, data, bytes_to_read);
- if(n < 0) {
- if(errno == EINTR) {
- continue;
- } else {
- D("ERROR: fd = %d, n = %d, errno = %d\n", h->fd, n, errno);
- return -1;
- }
+ //D("about to read (fd=%d, len=%zu)\n", h->fd, len);
+ int l = len;
+ while (l > 0) {
+ /* The sdb_read does not support read larger than 4096 bytes at once.
+ Read 4096 byte block repeatedly when reading data is larger than 4096 bytes. */
+ int bytes_to_read = l < 4096 ? l : 4096;
+ int n = sdb_read(h->fd, data, bytes_to_read);
+ if (n < 0) {
+ if (errno == EINTR) {
+ continue;
+ } else {
+ E("ERROR: fd = %d, n = %d, errno = %d\n", h->fd, n, errno);
+ return -1;