[PATCH mkfontscale] Prefer original file over symlink.

Julien Cristau jcristau at debian.org
Thu Jan 3 11:45:08 PST 2013


On Thu, Jan  3, 2013 at 13:14:58 -0500, Egbert Eich wrote:

> @@ -836,6 +841,16 @@ doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo)
>  
>          filename = dsprintf("%s%s", dirname, entry->d_name);
>  
> +#define PRIO(x) ((x << 1) + tprio)
> +#ifdef _BSD_SOURCE

this should be #ifdef DT_LNK...

> +    if (DT_LNK & entry->d_type)
> +	tprio = 0;
> +#else

and should fall back to lstat if d_type is D_UNKNOWN.

Cheers,
Julien

> +    if (lstat(filename, &f_stat))
> +	    goto done;    
> +    if (S_ISLNK(file_stat.st_mode))
> +	tprio = 0;
> +#endif
>          if(doBitmaps)
>              rc = bitmapIdentify(filename, &xlfd_name);
>          else
> @@ -896,7 +911,7 @@ doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo)
>                  xlfd = listCons(s, xlfd);
>              } else {
>                  /* Not a reencodable font -- skip all the rest of the loop body */
> -                putHash(entries, xlfd_name, entry->d_name, filePrio(entry->d_name));
> +                putHash(entries, xlfd_name, entry->d_name, PRIO(filePrio(entry->d_name)));
>                  goto done;
>              }
>          }
> @@ -930,7 +945,7 @@ doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo)
>                      found = 1;
>                      snprintf(buf, MAXFONTNAMELEN, "%s-%s",
>                              lp->value, encoding->value);
> -                    putHash(entries, buf, entry->d_name, filePrio(entry->d_name));
> +                    putHash(entries, buf, entry->d_name, PRIO(filePrio(entry->d_name)));
>                  }
>              }
>              for(encoding = extra_encodings; encoding;
> @@ -939,7 +954,7 @@ doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo)
>                      /* Do not set found! */
>                      snprintf(buf, MAXFONTNAMELEN, "%s-%s",
>                              lp->value, encoding->value);
> -                    putHash(entries, buf, entry->d_name, filePrio(entry->d_name));
> +                    putHash(entries, buf, entry->d_name, PRIO(filePrio(entry->d_name)));
>                  }
>              }
>          }
> @@ -949,6 +964,7 @@ doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo)
>          deepDestroyList(xlfd);
>          xlfd = NULL;
>          free(filename);
> +#undef PRIO
>      }
>  
>      closedir(dirp);
> -- 
> 1.7.7
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list