]> git.pld-linux.org Git - packages/XFree86.git/blob - XFree86-xfsredhat.patch
- XFree patches.
[packages/XFree86.git] / XFree86-xfsredhat.patch
1 --- XFree86-3.3.3.1/xc/programs/xfs/difs/fonts.c.xfsredhat      Fri Jan  5 08:21:27 1996
2 +++ XFree86-3.3.3.1/xc/programs/xfs/difs/fonts.c        Wed Feb 17 12:03:19 1999
3 @@ -118,6 +118,113 @@
4  }
5  
6  /*
7 + * xf86GetPathElem --
8 + *      Extract a single element from the font path string starting at
9 + *      pnt.  The font path element will be returned, and pnt will be
10 + *      updated to point to the start of the next element, or set to
11 + *      NULL if there are no more.
12 + */
13 +char *
14 +xf86GetPathElem(pnt)
15 +     char **pnt;
16 +{
17 +  char *p1;
18
19 +  p1 = *pnt;
20 +  *pnt = index(*pnt, ',');
21 +  if (*pnt != NULL) {
22 +    **pnt = '\0';
23 +    *pnt += 1;
24 +  }
25 +  return(p1);
26 +}
27 +
28 +/*
29 + * xf86ValidateFontPath --
30 + *      Validates the user-specified font path.  Each element that
31 + *      begins with a '/' is checked to make sure the directory exists.
32 + *      If the directory exists, the existence of a file named 'fonts.dir'
33 + *      is checked.  If either check fails, an error is printed and the
34 + *      element is removed from the font path.
35 + */
36 +#define DIR_FILE "/fonts.dir"
37 +#define CHECK_TYPE(mode, type) ((S_IFMT & (mode)) == (type))
38 +static char *
39 +xf86ValidateFontPath(path)
40 +     char *path;
41 +{
42 +  char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem;
43 +  struct stat stat_buf;
44 +  int flag;
45 +  int dirlen;
46
47 +  tmp_path = (char *)calloc(1,strlen(path)+1);
48 +  out_pnt = tmp_path;
49 +  path_elem = NULL;
50 +  next = path;
51 +  while (next != NULL) {
52 +    path_elem = xf86GetPathElem(&next);
53 +#ifndef __EMX__
54 +    if (*path_elem == '/') {
55 +      dir_elem = (char *)calloc(1, strlen(path_elem) + 1);
56 +      if ((p1 = strchr(path_elem, ':')) != 0)
57 +#else
58 +    /* OS/2 must prepend X11ROOT */
59 +    if (*path_elem == '/') {
60 +      path_elem = (char*)__XOS2RedirRoot(path_elem);
61 +      dir_elem = (char*)calloc(1, strlen(path_elem) + 1);
62 +      if (p1 = strchr(path_elem+2, ':'))
63 +#endif
64 +        dirlen = p1 - path_elem;
65 +      else
66 +        dirlen = strlen(path_elem);
67 +      strncpy(dir_elem, path_elem, dirlen);
68 +      dir_elem[dirlen] = '\0';
69 +      flag = stat(dir_elem, &stat_buf);
70 +      if (flag == 0)
71 +        if (!CHECK_TYPE(stat_buf.st_mode, S_IFDIR))
72 +          flag = -1;
73 +      if (flag != 0) {
74 +       printf("warning!\n");
75 +       ErrorF("Warning: The directory \"%s\" does not exist.\n", dir_elem);
76 +       ErrorF("         Entry deleted from font path.\n");
77 +        continue;
78 +      }
79 +      else {
80 +        p1 = (char *)malloc(strlen(dir_elem)+strlen(DIR_FILE)+1);
81 +        strcpy(p1, dir_elem);
82 +        strcat(p1, DIR_FILE);
83 +        flag = stat(p1, &stat_buf);
84 +        if (flag == 0)
85 +          if (!CHECK_TYPE(stat_buf.st_mode, S_IFREG))
86 +            flag = -1;
87 +#ifndef __EMX__
88 +        free(p1);
89 +#endif
90 +        if (flag != 0) {
91 +         ErrorF("Warning: 'fonts.dir' not found (or not valid) in \"%s\".\n",
92 +                 dir_elem);
93 +          ErrorF("          Entry deleted from font path.\n");
94 +          ErrorF("          (Run 'mkfontdir' on \"%s\").\n", dir_elem);
95 +          continue;
96 +        }
97 +      }
98 +      free(dir_elem);
99 +    }
100
101 +    /*
102 +     * Either an OK directory, or a font server name.  So add it to
103 +     * the path.
104 +     */
105 +    if (out_pnt != tmp_path)
106 +      *out_pnt++ = ',';
107 +    strcat(out_pnt, path_elem);
108 +    out_pnt += strlen(path_elem);
109 +  }
110 +  return(tmp_path);
111 +}
112 +
113 +/*
114   * note that the font wakeup queue is not refcounted.  this is because
115   * an fpe needs to be added when it's inited, and removed when it's finally
116   * freed, in order to handle any data that isn't requested, like FS events.
117 @@ -753,8 +860,12 @@
118                 *end,
119                 *p;
120      int         err;
121 +    char       *fixedpath;
122 +
123 +    fixedpath = xf86ValidateFontPath(str);
124  
125 -    len = strlen(str) + 1;
126 +    len = strlen(fixedpath) + 1;
127 +    str = fixedpath;
128      paths = p = (char *) ALLOCATE_LOCAL(len);
129      npaths = 0;
130  
131 @@ -774,6 +885,7 @@
132  
133      err = set_font_path_elements(npaths, paths, badpath);
134  
135 +    free(fixedpath);
136      DEALLOCATE_LOCAL(paths);
137  
138      return err;
139 --- XFree86-3.3.3.1/xc/programs/xfs/difs/main.c.xfsredhat       Thu Nov  5 14:28:29 1998
140 +++ XFree86-3.3.3.1/xc/programs/xfs/difs/main.c Wed Feb 17 17:08:27 1999
141 @@ -58,6 +58,7 @@
142  #include       "servermd.h"
143  #include       "cache.h"
144  #include       "site.h"
145 +#include <unistd.h>
146  
147  char       *ConnectionInfo;
148  int         ConnInfoLen;
149 @@ -107,6 +108,8 @@
150         ErrorF("fatal: couldn't read config file\n");
151         exit(1);
152      }
153 +
154 +    daemon(0, 0);
155  
156      while (1) {
157         serverGeneration++;
This page took 0.065134 seconds and 3 git commands to generate.