Bug#643577: gpicview: FTBFS on hurd-i386
Package: gpicview
Version: 0.2.2-1
Severity: important
Tags: patch
User: debian-hurd@lists.debian.org
Usertags: hurd
Hello,
gpicview currently does not build on GNU/Hurd due to bug #642000 and
PATH_MAX issues. The attached small patches fixes this problem. The
first patch changes the libjpeg62-dev dependency to libjpeg-dev and the
other solves the build problems of GNU/Hurd by dynamic memory
allocation.
Thanks!
diff -ur gpicview-0.2.2/debian/control gpicview-0.2.2.modified//debian/control
--- gpicview-0.2.2/debian/control 2011-07-24 16:51:51.000000000 +0000
+++ gpicview-0.2.2.modified//debian/control 2011-09-27 18:26:59.000000000 +0000
@@ -3,7 +3,7 @@
Priority: optional
Maintainer: Debian LXDE Packaging Team <pkg-lxde-maintainers@lists.alioth.debian.org>
Uploaders: Andrew Lee (����) <ajqlee@debian.org>
-Build-Depends: debhelper (>= 8), intltool, libgtk2.0-dev, libjpeg62-dev
+Build-Depends: debhelper (>= 8), intltool, libgtk2.0-dev, libjpeg-dev
Standards-Version: 3.9.2
DM-Upload-Allowed: yes
Homepage: http://lxde.org
diff -ur gpicview-0.2.2/src/jhead.h gpicview-0.2.2.modified//src/jhead.h
--- gpicview-0.2.2/src/jhead.h 2011-07-23 13:53:24.000000000 +0000
+++ gpicview-0.2.2.modified//src/jhead.h 2011-09-27 18:23:51.000000000 +0000
@@ -41,6 +41,10 @@
#define PATH_MAX _MAX_PATH
#endif
+#ifdef __GNU__
+ #define PATH_MAX 4096
+#endif
+
//--------------------------------------------------------------------------
// This structure is used to store jpeg file sections in memory.
typedef struct {
diff -ur gpicview-0.2.2/src/jpeg-tran.c gpicview-0.2.2.modified//src/jpeg-tran.c
--- gpicview-0.2.2/src/jpeg-tran.c 2011-07-23 13:53:24.000000000 +0000
+++ gpicview-0.2.2.modified//src/jpeg-tran.c 2011-09-27 18:22:23.000000000 +0000
@@ -195,7 +195,7 @@
int rotate_and_save_jpeg_lossless(char * filename,int angle)
{
- char tmpfilename[PATH_MAX];
+ char *tmpfilename;
int tmpfilefd;
/*
@@ -219,13 +219,14 @@
code = JXFORM_FLIP_V;
/* Length check temporary file name. */
- if(strlen(filename) > (sizeof(tmpfilename) - 8))
+ if((tmpfilename = malloc(strlen(filename)+8)) == NULL)
return EINVAL;
sprintf(tmpfilename, "%s.XXXXXX", filename);
/* Create temporary file. */
tmpfilefd = mkstemp(tmpfilename);
if (tmpfilefd == -1) {
+ free(tmpfilename);
return errno;
}
close(tmpfilefd);
@@ -235,6 +236,7 @@
if(error) {
int saved_errno = errno;
unlink(tmpfilename);
+ free(tmpfilename);
return saved_errno;
}
@@ -243,8 +245,10 @@
if (error_1 == -1) {
int saved_errno = errno;
unlink(tmpfilename);
+ free(tmpfilename);
return saved_errno;
}
+ free(tmpfilename);
return 0;
}
Reply to: