diff options
Diffstat (limited to 'Ports/citron/patches/0001-Get-rid-of-wordexp-on-serenity.patch')
-rw-r--r-- | Ports/citron/patches/0001-Get-rid-of-wordexp-on-serenity.patch | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/Ports/citron/patches/0001-Get-rid-of-wordexp-on-serenity.patch b/Ports/citron/patches/0001-Get-rid-of-wordexp-on-serenity.patch new file mode 100644 index 0000000000..003c8b50ac --- /dev/null +++ b/Ports/citron/patches/0001-Get-rid-of-wordexp-on-serenity.patch @@ -0,0 +1,79 @@ +From 55c1e96ff844e75a9bf07114e00e27fabb7f54ee Mon Sep 17 00:00:00 2001 +From: Ali Mohammad Pur <ali.mpfard@gmail.com> +Date: Fri, 11 Feb 2022 16:13:52 +0330 +Subject: [PATCH 1/9] Get rid of wordexp on serenity + +--- + src/file.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/src/file.c b/src/file.c +index a3bfd16..720a6e5 100644 +--- a/src/file.c ++++ b/src/file.c +@@ -18,11 +18,13 @@ + #include "citron.h" + #include "siphash.h" + #include <dirent.h> ++#ifndef __serenity__ + #include <wordexp.h> + + #ifndef WORDEXP_READY + # define WORDEXP_READY 1 + #endif ++#endif + + #include <termios.h> + static struct termios oldTermios, newTermios; +@@ -461,6 +463,7 @@ ctr_object* ctr_file_rpath(ctr_object* myself, ctr_argument* argumentList) + char rpath[PATH_MAX + 1]; + char* ret = realpath(cpath, rpath); + if (!ret) { ++#ifndef __serenity__ + if (WORDEXP_READY) { + wordexp_t exp_result; + int st = wordexp(cpath, &exp_result, 0); +@@ -469,6 +472,7 @@ ctr_object* ctr_file_rpath(ctr_object* myself, ctr_argument* argumentList) + memset(rpath, 0, PATH_MAX); + memcpy(rpath, r, strlen(r)); + wordfree(&exp_result); ++ ret = rpath; + } else { + char* err; + switch (st) { +@@ -499,8 +503,13 @@ ctr_object* ctr_file_rpath(ctr_object* myself, ctr_argument* argumentList) + CtrStdFlow = ctr_build_string_from_cstring(strerror(errno)); + return CtrStdNil; + } ++#else ++ ctr_heap_free(cpath); ++ CtrStdFlow = ctr_build_string_from_cstring(strerror(errno)); ++ return CtrStdNil; ++#endif + } +- path = ctr_build_string_from_cstring(rpath); ++ path = ctr_build_string_from_cstring(ret); + ctr_heap_free(cpath); + return path; + } +@@ -515,6 +524,9 @@ ctr_object* ctr_file_expand(ctr_object* myself, ctr_argument* argumentList) + if (argumentList->object == NULL) + return CtrStdNil; + ctr_object* path = ctr_internal_cast2string(argumentList->object); ++#ifdef __serenity__ ++ return path; ++#else + char* cpath = ctr_heap_allocate_cstring(path); + wordexp_t exp_result; + int st = wordexp(cpath, &exp_result, 0); +@@ -557,6 +569,7 @@ ctr_object* ctr_file_expand(ctr_object* myself, ctr_argument* argumentList) + return CtrStdNil; + } + return arr; ++#endif + } + + /** +-- +2.34.1 + |