Bug#622365: Fix FTBFS of tofrodos for GNU/Hurd
Package: tofrodos
Version: 1.7.8.debian.1-2
Severity: important
Tags: patch
Usertags: hurd
Attached is a patch to enable successful build of tofrodos on
GNU/Hurd. It should be applied after the FTBFS_kfreebsd.diff patch.
The only question is if I've missed a free() somewhere. In my opinion it
does not make sense to add a free() after a return statement, does it?
Making this package build enables latex2rtf to be built that is on the
old-package list:
http://ftp-master.debian.org/users/twerner/pre-lenny.txt
Additionally, it makes debian-cd installable since it depends on this
package.
diff -ur ./tofrodos-1.7.8.debian.1/src/config.h tofrodos-1.7.8.debian.1.new/src/config.h
--- ./tofrodos-1.7.8.debian.1/src/config.h 2011-04-12 16:10:02.000000000 +0200
+++ tofrodos-1.7.8.debian.1.new/src/config.h 2011-04-12 16:18:06.000000000 +0200
@@ -102,7 +102,7 @@
#endif
#endif
-#if defined(__FreeBSD__) || defined(__OpenBSD__) /* seems to work like Linux... */
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__GNU__) /* seems to work like Linux... */
#if !defined(LINUX)
#define LINUX
#endif
diff -ur ./tofrodos-1.7.8.debian.1/src/tofrodos.c tofrodos-1.7.8.debian.1.new/src/tofrodos.c
--- ./tofrodos-1.7.8.debian.1/src/tofrodos.c 2008-04-08 06:57:05.000000000 +0200
+++ tofrodos-1.7.8.debian.1.new/src/tofrodos.c 2011-04-12 16:22:22.000000000 +0200
@@ -14,7 +14,9 @@
#include <stdlib.h> /* EXIT_SUCCESS, mkstemp() in some systems */
#include <string.h> /* strrchr(), strlen(), strcpy(), strcat() */
#include <sys/stat.h> /* stat() */
-
+#ifdef __GNU__
+#include <limits.h>
+#endif
#if defined(UNIX)
#if defined(MAXPATHLEN_HEADER)
#include MAXPATHLEN_HEADER
@@ -443,8 +445,12 @@
static int openandconvert_preamble ( char * filename )
{
struct stat statbuf ;
+#ifndef __GNU__
char realfilepath[MAXPATHLEN+1] ;
int len ;
+#else
+ char *realfilepath ;
+#endif
/* get the file information */
if (lstat( filename, &statbuf )) {
@@ -461,16 +467,24 @@
/* eg, #define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK) */
/* or something like that. */
+#ifndef __GNU__
if ((len = readlink( filename, realfilepath, (sizeof(realfilepath) - 1) )) != -1) {
/* got to null terminate the string - there is always space because */
/* we passed readlink() the size of the buffer less 1. */
realfilepath[len] = '\0' ;
+#else
+ realfilepath = realpath (filename, NULL);
+ if ((realfilepath) != NULL) {
+#endif
if (verbose) {
emsg( VERBOSE_SYMLINKSRC, filename, realfilepath );
}
return openandconvert( realfilepath );
}
emsg( EMSG_SYMLINK, filename );
+#ifdef __GNU__
+ free (realfilepath);
+#endif
return -1 ;
}
/* If we reach here, "filename" is not a symbolic link */
Reply to: