aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-07-23 20:52:04 +0200
committerJade Lovelace <lix@jade.fyi>2024-07-23 20:52:04 +0200
commit916b5c68fb14fd77c739b05595211b2b008f99f9 (patch)
tree235c6ddce38bfcfeabe206826626e9a0302e5959
parent73c013a5df09a9edf7a6d2fa0be8349d89f856cd (diff)
libutil: rip out GNU Hurd support code
Nobody has stepped up to add further support for Hurd since this code appeared in 2010 or 2014. We don't need it. Change-Id: I400b2031a225551ea3c71a3ef3ea9fdb599dfba3
-rw-r--r--src/libutil/file-system.cc16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/libutil/file-system.cc b/src/libutil/file-system.cc
index f0199d36f..e2319ec59 100644
--- a/src/libutil/file-system.cc
+++ b/src/libutil/file-system.cc
@@ -21,22 +21,14 @@ Path absPath(Path path, std::optional<PathView> dir, bool resolveSymlinks)
{
if (path.empty() || path[0] != '/') {
if (!dir) {
-#ifdef __GNU__
- /* GNU (aka. GNU/Hurd) doesn't have any limitation on path
- lengths and doesn't define `PATH_MAX'. */
- char *buf = getcwd(NULL, 0);
- if (buf == NULL)
-#else
char buf[PATH_MAX];
- if (!getcwd(buf, sizeof(buf)))
-#endif
+ if (!getcwd(buf, sizeof(buf))) {
throw SysError("cannot get cwd");
+ }
path = concatStrings(buf, "/", path);
-#ifdef __GNU__
- free(buf);
-#endif
- } else
+ } else {
path = concatStrings(*dir, "/", path);
+ }
}
return canonPath(path, resolveSymlinks);
}