From 916b5c68fb14fd77c739b05595211b2b008f99f9 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Tue, 23 Jul 2024 20:52:04 +0200 Subject: [PATCH] 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 --- src/libutil/file-system.cc | 16 ++++------------ 1 file 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 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); }