]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'dl/wrapper-fix-indentation'
authorJunio C Hamano <gitster@pobox.com>
Wed, 22 Apr 2020 20:42:46 +0000 (13:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Apr 2020 20:42:47 +0000 (13:42 -0700)
Coding style fix.

* dl/wrapper-fix-indentation:
  wrapper: indent with tabs

1  2 
wrapper.c

diff --cc wrapper.c
index e1eaef2e1641457fabc8ab00b68d3b6b3f0e2354,0d5108bab68bce63f54fe7321442f531d9af39b3..3a1c0e052677dca8d1bc19121d609e0c226e88ee
+++ b/wrapper.c
@@@ -218,15 -147,11 +218,15 @@@ ssize_t xread(int fd, void *buf, size_
  {
        ssize_t nr;
        if (len > MAX_IO_SIZE)
-           len = MAX_IO_SIZE;
+               len = MAX_IO_SIZE;
        while (1) {
                nr = read(fd, buf, len);
 -              if ((nr < 0) && (errno == EAGAIN || errno == EINTR))
 -                      continue;
 +              if (nr < 0) {
 +                      if (errno == EINTR)
 +                              continue;
 +                      if (handle_nonblock(fd, POLLIN, errno))
 +                              continue;
 +              }
                return nr;
        }
  }
@@@ -240,32 -165,9 +240,32 @@@ ssize_t xwrite(int fd, const void *buf
  {
        ssize_t nr;
        if (len > MAX_IO_SIZE)
-           len = MAX_IO_SIZE;
+               len = MAX_IO_SIZE;
        while (1) {
                nr = write(fd, buf, len);
 +              if (nr < 0) {
 +                      if (errno == EINTR)
 +                              continue;
 +                      if (handle_nonblock(fd, POLLOUT, errno))
 +                              continue;
 +              }
 +
 +              return nr;
 +      }
 +}
 +
 +/*
 + * xpread() is the same as pread(), but it automatically restarts pread()
 + * operations with a recoverable error (EAGAIN and EINTR). xpread() DOES
 + * NOT GUARANTEE that "len" bytes is read even if the data is available.
 + */
 +ssize_t xpread(int fd, void *buf, size_t len, off_t offset)
 +{
 +      ssize_t nr;
 +      if (len > MAX_IO_SIZE)
 +              len = MAX_IO_SIZE;
 +      while (1) {
 +              nr = pread(fd, buf, len, offset);
                if ((nr < 0) && (errno == EAGAIN || errno == EINTR))
                        continue;
                return nr;