[stsf-commit] stsf/STFontServer/src fontserver.c, 1.5, 1.6 handler.c, 1.7, 1.8 stfs-door.c, 1.8, 1.9

Alexander Gelfenbain stsf-commit at pdx.freedesktop.org
Fri Jun 4 22:23:06 PDT 2004


Committed by: adg


Index: fontserver.c
===================================================================
RCS file: /cvs/stsf/stsf/STFontServer/src/fontserver.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- a/fontserver.c	30 May 2004 23:07:17 -0000	1.5
+++ b/fontserver.c	5 Jun 2004 05:23:04 -0000	1.6
@@ -878,6 +878,7 @@
        q = strstr(iURL[i], "file:") == iURL[i] ? iURL[i] + 5 : iURL[i];
       
        if ((fd = open(q, O_RDONLY)) != -1) {
+           DebugStr(1, "%s: calling mmap(%d, %s)", __func__, st.st_size, q);
            if (fstat(fd, &st) != -1 && (p = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0)) != MAP_FAILED) {
                if ((tempfd = mkstemp(tempfile)) != -1) {
                    if (write(tempfd, p, st.st_size) == st.st_size) {
@@ -902,6 +903,7 @@
                    ret = ST_FILEIO;
                    goto cleanup;
                }
+               DebugStr(1, "%s: calling munmap(%d)", __func__, st.st_size);
                munmap(p, st.st_size);
            } else {
                ret = ST_FILEIO;
@@ -1528,7 +1530,7 @@
     }
 
     res = glue->RenderGlyph(fi, font, glyphID, fracdelta, metrics, buffersize, buffer);
-    DebugStr(3, "glue::RenderGlyph(%d:%d:<%d-%d>) -> [w: %d, h: %d, r: %d] AdvH: (%f %f), AdvV: (%f %f) TLH (%f %f) TLV (%f %f)",
+    DebugStr(2, "glue::RenderGlyph(%d:%d:<%d-%d>) -> [w: %d, h: %d, r: %d] AdvH: (%f %f), AdvV: (%f %f) TLH (%f %f) TLV (%f %f)",
              instanceID, glyphID, fracdelta >> 8, fracdelta & 0xFF,
              metrics->width, metrics->height, metrics->bytesPerRow,
              F16DOT16_TO_FLOAT(metrics->xAdvH), F16DOT16_TO_FLOAT(metrics->yAdvH),

Index: handler.c
===================================================================
RCS file: /cvs/stsf/stsf/STFontServer/src/handler.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- a/handler.c	30 May 2004 23:07:17 -0000	1.7
+++ b/handler.c	5 Jun 2004 05:23:04 -0000	1.8
@@ -700,7 +700,7 @@
                   data = calloc(q->streamcount, sizeof(byte *));
 
                   if (data != NULL) {
-                      char *ptr = mmap(NULL, q->totalsize, PROT_READ|PROT_WRITE, MAP_SHARED, *fd, 0);
+                      char *ptr = mmap(NULL, (size_t) q->totalsize, PROT_READ|PROT_WRITE, MAP_SHARED, *fd, 0);
                       
                       if (ptr == MAP_FAILED) {
                           ret = ST_FILEIO;

Index: stfs-door.c
===================================================================
RCS file: /cvs/stsf/stsf/STFontServer/src/stfs-door.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- a/stfs-door.c	30 May 2004 23:07:17 -0000	1.8
+++ b/stfs-door.c	5 Jun 2004 05:23:04 -0000	1.9
@@ -161,17 +161,6 @@
         goto cleanup;
     }
 
-#if 0
-    
-    if ((stat(STSF_TEMPDIR, &st) == -1) && 
-        (CreateDir(STSF_TEMPDIR, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) ||
-        chown(STSF_TEMPDIR, STFS_UID, STFS_GID))) {
-        ErrorStr("Error creating STSF shared memory directory: %s.", STSF_TEMPDIR);
-        ret = ST_FILEIO;
-        goto cleanup;
-    }
-#endif
-
     strlcpy(filename, STSF_TEMPDIR, PATH_MAX);
     strlcat(filename, "/", PATH_MAX);
     strlcat(filename, SHMEM_PATTERN, PATH_MAX); 
@@ -226,7 +215,6 @@
 cleanup:
     if (fd != -1) close(fd);
     if (pa != NULL) munmap (pa, SHMEM_SIZE);
-    // *filename = '\0';
     *addr = NULL;
     *len = 0;
     return ret;
@@ -693,6 +681,9 @@
     CheckTempDir(STSF_TEMPDIR, STFS_UID, STFS_GID);
     CreateSTSFDir(STSF_TEMPDIR, STFS_UID, STFS_GID);
     CreateSTSFDir(STSF_TEMPFONTDIR, STFS_UID, STFS_GID);
+    
+    /* Remove the door file */
+    DelTree(STFS_DOOR);
 
     setegid(STFS_GID);          /* daemon */
     seteuid(STFS_UID);          /* daemon */
@@ -811,7 +802,12 @@
     if ((pid = fork()) != 0) exit(0);
 
     chdir("/");
+
+#if HAVE_CLOSEFROM
+    closefrom(0);
+#else
     for(i = 0; i < 256; i++) close(i);
+#endif
 
 #if HAVE_SETPROCTITLE
      setproctitle("-%s", modname);




More information about the stsf-commit mailing list