yodl: FTBFS on hurd-i386 (for review)
Source: yodl
Version: 3.00.0-6
Severity: Important
Usertags: hurd
User: debian-hurd@lists.debian.org
Hi, the attached patch enables yodl to build on GNU/Hurd again. The
patch includes usage of features specified by POSIX 2008!
Thanks!
To the list: OK to submit?
diff -ur yodl-3.00.0/src/lexer/lchdir.c yodl-3.00.0.new/src/lexer/lchdir.c
--- yodl-3.00.0/src/lexer/lchdir.c 2010-11-08 17:09:36.000000000 +0100
+++ yodl-3.00.0.new/src/lexer/lchdir.c 2012-08-22 15:52:06.000000000 +0200
@@ -7,12 +7,22 @@
{
// fprintf(stderr, "CHANGING WD\n");
+#if (_POSIX_VERSION >= 200809L)
+ char *resolved = NULL;
+ bool cdOK = false;
+ resolved = realpath(media_filename(lp->d_media_ptr), NULL);
+ if (resolved != NULL) cdOK = true;
+#else
char resolved[PATH_MAX];
bool cdOK = realpath(media_filename(lp->d_media_ptr), resolved) != NULL;
+#endif
if (cdOK)
{
*(strrchr(resolved, '/') + 1) = 0;
cdOK = chdir(resolved) == 0;
+#if (_POSIX_VERSION >= 200809L)
+ free(resolved);
+#endif
}
if (!cdOK)
{
diff -ur yodl-3.00.0/src/new/newgetcwd.c yodl-3.00.0.new/src/new/newgetcwd.c
--- yodl-3.00.0/src/new/newgetcwd.c 2010-11-08 15:50:47.000000000 +0100
+++ yodl-3.00.0.new/src/new/newgetcwd.c 2012-08-24 15:02:44.000000000 +0200
@@ -2,11 +2,18 @@
char *new_getcwd()
{
+#if (_POSIX_VERSION >= 200809L)
+ char *cwd = NULL;
+
+ cwd = getcwd(NULL, 0);
+ if (cwd == NULL && message_show(MSG_ALERT))
+ message("Can't determine current working directory");
+#else
char *cwd = n_malloc(PATH_MAX + 1);
if (!getcwd(cwd, PATH_MAX) && message_show(MSG_ALERT))
message("Can't determine current working directory");
-
+#endif
size_t length = strlen(cwd);
if (cwd[length - 1] != '/')
{
Reply to: