diff --git a/git-compat-util.h b/git-compat-util.h
index 4185b12741f802842f2aebc128c61051db65c13d..0c98c9937df14bfa8be4f58cae84aa16029be883 100644 (file)
--- a/git-compat-util.h
+++ b/git-compat-util.h
return ret;
}
+static inline ssize_t xread(int fd, void *buf, size_t len)
+{
+ ssize_t nr;
+ while (1) {
+ nr = read(fd, buf, len);
+ if ((nr < 0) && (errno == EAGAIN || errno == EINTR))
+ continue;
+ return nr;
+ }
+}
+
+static inline ssize_t xwrite(int fd, const void *buf, size_t len)
+{
+ ssize_t nr;
+ while (1) {
+ nr = write(fd, buf, len);
+ if ((nr < 0) && (errno == EAGAIN || errno == EINTR))
+ continue;
+ return nr;
+ }
+}
+
/* Sane ctype - no locale, and works with signed chars */
#undef isspace
#undef isdigit
return x;
}
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 256
+#endif
#endif