summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/lib/file.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-10-31 20:11:41 (GMT)
committerBrad King <brad.king@kitware.com>2022-10-31 20:11:41 (GMT)
commit9ffe6b0969fc270cc2a1aac2b2c1bf986af291d5 (patch)
tree75711965f7fd24679383853a840f42efff676e31 /Utilities/cmcurl/lib/file.c
parentfa9bbb8627e8af5153367721eb037b6e094670d1 (diff)
parentec122fff08ab9a8e56fb90126ecedb99c759011b (diff)
downloadCMake-9ffe6b0969fc270cc2a1aac2b2c1bf986af291d5.zip
CMake-9ffe6b0969fc270cc2a1aac2b2c1bf986af291d5.tar.gz
CMake-9ffe6b0969fc270cc2a1aac2b2c1bf986af291d5.tar.bz2
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2022-10-26 (cd95ee9f)
Diffstat (limited to 'Utilities/cmcurl/lib/file.c')
-rw-r--r--Utilities/cmcurl/lib/file.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/Utilities/cmcurl/lib/file.c b/Utilities/cmcurl/lib/file.c
index 3da79a2..d82d57b 100644
--- a/Utilities/cmcurl/lib/file.c
+++ b/Utilities/cmcurl/lib/file.c
@@ -18,6 +18,8 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
+ * SPDX-License-Identifier: curl
+ *
***************************************************************************/
#include "curl_setup.h"
@@ -69,6 +71,8 @@
#if defined(WIN32) || defined(MSDOS) || defined(__EMX__)
#define DOS_FILESYSTEM 1
+#elif defined(__amigaos4__)
+#define AMIGA_FILESYSTEM 1
#endif
#ifdef OPEN_NEEDS_ARG3
@@ -194,8 +198,33 @@ static CURLcode file_connect(struct Curl_easy *data, bool *done)
return CURLE_URL_MALFORMAT;
}
+ #ifdef AMIGA_FILESYSTEM
+ /*
+ * A leading slash in an AmigaDOS path denotes the parent
+ * directory, and hence we block this as it is relative.
+ * Absolute paths start with 'volumename:', so we check for
+ * this first. Failing that, we treat the path as a real unix
+ * path, but only if the application was compiled with -lunix.
+ */
+ fd = -1;
+ file->path = real_path;
+
+ if(real_path[0] == '/') {
+ extern int __unix_path_semantics;
+ if(strchr(real_path + 1, ':')) {
+ /* Amiga absolute path */
+ fd = open_readonly(real_path + 1, O_RDONLY);
+ file->path++;
+ }
+ else if(__unix_path_semantics) {
+ /* -lunix fallback */
+ fd = open_readonly(real_path, O_RDONLY);
+ }
+ }
+ #else
fd = open_readonly(real_path, O_RDONLY);
file->path = real_path;
+ #endif
#endif
file->freepath = real_path; /* free this when done */
@@ -234,7 +263,7 @@ static CURLcode file_disconnect(struct Curl_easy *data,
{
(void)dead_connection; /* not used */
(void)conn;
- return file_done(data, 0, 0);
+ return file_done(data, CURLE_OK, FALSE);
}
#ifdef DOS_FILESYSTEM