Newer
Older
minerva / Ports / mrsh / patches / 0002-Hardcode-default-path-because-confstr-is-missing.patch
@minerva minerva on 13 Jul 939 bytes Initial commit
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 __minerva__
 		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 __minerva__
 		if (confstr(_CS_PATH, pathe, pathe_size) != pathe_size) {
 			free(pathe);
 			return NULL;
 		}
+#endif
 	}
 
 	char *path = NULL;