openbsd-ports/x11/xfstt/patches/patch-xfstt_cpp
ish c6fb86505a - fix permissions on socket
- suggest to run the daemon as non-root
- ok matthieu, pval
2003-03-03 06:54:11 +00:00

48 lines
1.6 KiB
Plaintext

$OpenBSD: patch-xfstt_cpp,v 1.4 2003/03/03 06:54:11 ish Exp $
--- xfstt.cpp.orig Sat Dec 11 12:23:45 1999
+++ xfstt.cpp Mon Nov 25 16:32:38 2002
@@ -11,8 +11,8 @@
#define UNSTRAPLIMIT 10500U
// Change these if you don't lie being FHS complient
-#define TTFONTDIR "/usr/share/fonts/truetype"
-#define TTCACHEDIR "/var/cache/xfstt"
+#define TTFONTDIR "/usr/local/lib/X11/fonts/TrueType"
+#define TTCACHEDIR "/usr/local/lib/X11/fonts/TrueType"
#define TTINFO_LEAF "ttinfo.dir"
#define TTNAME_LEAF "ttname.dir"
@@ -470,10 +470,12 @@ static XFSFont* openFont( TTFont* ttFont
raster->getFontExtent( &xfs->fe);
int used = (xfs->fe.bitmaps + xfs->fe.bmplen) - xfs->fe.buffer;
+ int bmpoff = xfs->fe.bitmaps - xfs->fe.buffer;
xfs->fe.buffer = (U8*)shrinkMem( xfs->fe.buffer, used);
- if( xfs->fe.buffer)
+ if( xfs->fe.buffer) {
xfs->fe.buflen = used;
- else {
+ xfs->fe.bitmaps = xfs->fe.buffer + bmpoff;
+ } else {
xfs->fid = 0; //###
xfs = 0;
}
@@ -642,7 +644,7 @@ static int prepare2connect( int portno)
s_unix.sa_family = PF_UNIX;
sprintf( s_unix.sa_data, "fs%d", portno);
sockname = s_unix.sa_data;
- mkdir( "/tmp/.font-unix", 0766);
+ mkdir( "/tmp/.font-unix", 0755);
chdir( "/tmp/.font-unix");
unlink( s_unix.sa_data);
if( bind( sd_unix, (struct sockaddr*)&s_unix, sizeof(s_unix))) {
@@ -650,6 +652,8 @@ static int prepare2connect( int portno)
fputs( "Please check permissions.\n", stderr);
}
listen( sd_unix, 1); // only one connection
+ if (chmod(s_unix.sa_data, 0777) == -1)
+ fprintf( stderr, "Couldn't set mode on /tmp/.font-unix/%s\n", s_unix.sa_data);
}
if( !sd_inet) {