X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Fnfs-cp.c;h=3d25189ca57b263718e60bd4c9af2557f17dfef7;hb=b4598f416f1d001d66badd0dc176cfef35b8fedf;hp=53e22d60209db560fa555fc1b1d09c4a1f663741;hpb=a6bc1707f7acebfd6cf1061cf0cd7e7dc57878ce;p=deb_libnfs.git diff --git a/examples/nfs-cp.c b/examples/nfs-cp.c index 53e22d6..3d25189 100644 --- a/examples/nfs-cp.c +++ b/examples/nfs-cp.c @@ -29,6 +29,8 @@ #ifdef WIN32 #include "win32_compat.h" +#pragma comment(lib, "ws2_32.lib") +WSADATA wsaData; #else #include #include @@ -96,7 +98,8 @@ static int64_t 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); } @@ -106,7 +109,8 @@ static int64_t 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); }