repositories
/
deb_libnfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change nfs-cp.c example to use lseek+read/write instead of pread/pwrite since some...
[deb_libnfs.git]
/
examples
/
nfs-cp.c
diff --git
a/examples/nfs-cp.c
b/examples/nfs-cp.c
index 53e22d60209db560fa555fc1b1d09c4a1f663741..eeea40423790d2b5b2ace872e76545f583db45b7 100644
(file)
--- a/
examples/nfs-cp.c
+++ b/
examples/nfs-cp.c
@@
-96,7
+96,8
@@
static int64_t
file_pread(struct file_context *fc, char *buf, int64_t count, uint64_t off)
{
if (fc->is_nfs == 0) {
file_pread(struct file_context *fc, char *buf, int64_t count, uint64_t off)
{
if (fc->is_nfs == 0) {
- return pread(fc->fd, buf, count, off);
+ lseek(fc->fd, off, SEEK_SET);
+ return read(fc->fd, buf, count);
} else {
return nfs_pread(fc->nfs, fc->nfsfh, off, count, buf);
}
} else {
return nfs_pread(fc->nfs, fc->nfsfh, off, count, buf);
}
@@
-106,7
+107,8
@@
static int64_t
file_pwrite(struct file_context *fc, char *buf, int64_t count, uint64_t off)
{
if (fc->is_nfs == 0) {
file_pwrite(struct file_context *fc, char *buf, int64_t count, uint64_t off)
{
if (fc->is_nfs == 0) {
- return pwrite(fc->fd, buf, count, off);
+ lseek(fc->fd, off, SEEK_SET);
+ return write(fc->fd, buf, count);
} else {
return nfs_pwrite(fc->nfs, fc->nfsfh, off, count, buf);
}
} else {
return nfs_pwrite(fc->nfs, fc->nfsfh, off, count, buf);
}