-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(x11/far2l): Backport patch to work with current libnfs
- Loading branch information
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
From bbf73ee62988b16d629a0f5e76faa7be14a4c490 Mon Sep 17 00:00:00 2001 | ||
From: elfmz <[email protected]> | ||
Date: Sat, 14 Dec 2024 11:15:40 +0300 | ||
Subject: [PATCH] fixing build with recent libnfs | ||
|
||
--- | ||
NetRocks/src/Protocol/NFS/ProtocolNFS.cpp | 10 +++++++++- | ||
1 file changed, 9 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/NetRocks/src/Protocol/NFS/ProtocolNFS.cpp b/NetRocks/src/Protocol/NFS/ProtocolNFS.cpp | ||
index a3c3e764e..4d8412f4e 100644 | ||
--- a/NetRocks/src/Protocol/NFS/ProtocolNFS.cpp | ||
+++ b/NetRocks/src/Protocol/NFS/ProtocolNFS.cpp | ||
@@ -507,7 +507,11 @@ class NFSFileIO : public IFileReader, public IFileWriter | ||
|
||
virtual size_t Read(void *buf, size_t len) | ||
{ | ||
+#ifdef LIBNFS_API_V2 | ||
+ const auto rc = nfs_read(_nfs->ctx, _file, (char *)buf, len); | ||
+#else | ||
const auto rc = nfs_read(_nfs->ctx, _file, len, (char *)buf); | ||
+#endif | ||
if (rc < 0) | ||
throw ProtocolError("Read file error", errno); | ||
// uncomment to simulate connection stuck if ( (rand()%100) == 0) sleep(60); | ||
@@ -518,7 +522,11 @@ class NFSFileIO : public IFileReader, public IFileWriter | ||
virtual void Write(const void *buf, size_t len) | ||
{ | ||
if (len > 0) for (;;) { | ||
- const auto rc = nfs_write(_nfs->ctx, _file, len, (char *)buf); | ||
+#ifdef LIBNFS_API_V2 | ||
+ const auto rc = nfs_write(_nfs->ctx, _file, (const char *)buf, len); | ||
+#else | ||
+ const auto rc = nfs_write(_nfs->ctx, _file, len, (const char *)buf); | ||
+#endif | ||
if (rc <= 0) | ||
throw ProtocolError("Write file error", errno); | ||
if ((size_t)rc >= len) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters