1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-30 15:47:34 +00:00

Ports: Update the citron patches after upstreaming a few

This also switches to checking out a specific commit instead of just the
master HEAD, as the port linter requires a hash (which is imo pointless
in this case), and we can't provide a stable hash for the master branch
HEAD.
This commit is contained in:
Ali Mohammad Pur 2022-02-13 17:06:03 +03:30 committed by Ali Mohammad Pur
parent 4b412e8fee
commit b760a1a4ba
23 changed files with 135 additions and 529 deletions

View file

@ -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