summaryrefslogtreecommitdiff
path: root/Ports/mrsh/patches/0002-Hardcode-default-path-because-confstr-is-missing.patch
blob: 7628ec7b1fa1ac16d2e08879e32edba544f4eb5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: EWouters <6179932+EWouters@users.noreply.github.com>
Date: Tue, 12 Apr 2022 18:00:04 +0200
Subject: [PATCH] Hardcode default path because `confstr` is missing

---
 shell/path.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/shell/path.c b/shell/path.c
index 3c2bf65..ee2c4e9 100644
--- a/shell/path.c
+++ b/shell/path.c
@@ -26,18 +26,24 @@ char *expand_path(struct mrsh_state *state, const char *file, bool exec,
 			return NULL;
 		}
 	} else {
+#ifndef __serenity__
 		size_t pathe_size = confstr(_CS_PATH, NULL, 0);
 		if (pathe_size == 0) {
 			return NULL;
 		}
 		pathe = malloc(pathe_size);
+#else
+		pathe = strdup("/bin:/usr/bin");
+#endif
 		if (pathe == NULL) {
 			return NULL;
 		}
+#ifndef __serenity__
 		if (confstr(_CS_PATH, pathe, pathe_size) != pathe_size) {
 			free(pathe);
 			return NULL;
 		}
+#endif
 	}
 
 	char *path = NULL;