diff options
Diffstat (limited to 'source4/lib/replace/replace.c')
-rw-r--r-- | source4/lib/replace/replace.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c index aa79f23fd0..c53b5a5727 100644 --- a/source4/lib/replace/replace.c +++ b/source4/lib/replace/replace.c @@ -523,3 +523,25 @@ int rep_mkstemp(char *template) return open(p, O_CREAT|O_EXCL|O_RDWR, 0600); } #endif + +#ifndef HAVE_PREAD +static ssize_t pread(int __fd, void *__buf, size_t __nbytes, off_t __offset) +{ + if (lseek(__fd, __offset, SEEK_SET) != __offset) { + return -1; + } + return read(__fd, __buf, __nbytes); +} +#endif + +#ifndef HAVE_PWRITE +static ssize_t pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset) +{ + if (lseek(__fd, __offset, SEEK_SET) != __offset) { + return -1; + } + return write(__fd, __buf, __nbytes); +} +#endif + + |