[Fontconfig-bugs] [Bug 39914] Please tag the cache directory with CACHEDIR.TAG

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Mar 21 09:45:12 PDT 2012


https://bugs.freedesktop.org/show_bug.cgi?id=39914

--- Comment #13 from Behdad Esfahbod <freedesktop at behdad.org> 2012-03-21 09:45:12 PDT ---
First:

+ static const FcChar8 cache_tag_contents[] =
+ "Signature: 8a477f597d28d172789f06886806bc55\n"
+ "# This file is a cache directory tag created by fontconfig.\n"
+ "# For information about cache directory tags, see:\n"
+ "# http://www.brynosaurus.com/cachedir/\n";
+ static size_t cache_tag_contents_size = 0;
+ FcBool ret = FcTrue;
+
+ if (cache_tag_contents_size == 0)
+ cache_tag_contents_size = strlen((char *)cache_tag_contents);

You can simply use "sizeof (cache_tag_contents)".  No need for runtime
strlen().


+ write(fd, cache_tag_contents, cache_tag_contents_size);

write() can fail with -EINTR.  Just use stdio or something.


Last but not least.  This is the wrong place to create this file.  Calling
fc-cache is by all means considered optional.  The file should be create in the
library.  Now, I'm inclined to say we should try creating it only when creating
the cache directory, but that wouldn't help existing users.  I'd rather not add
a stat() to every application's startup just for this file...

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the Fontconfig-bugs mailing list