summaryrefslogtreecommitdiff
path: root/external/harfbuzz/harfbuzz-fd-hack.patch.0
blob: 1cc5820fd49cb6d30417cdb38ad8a0acddc4b6ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# -*- Mode: Diff -*-
--- src/hb-blob.cc
+++ src/hb-blob.cc
@@ -737,7 +737,19 @@
   char *data = (char *) hb_malloc (allocated);
   if (unlikely (!data)) return nullptr;
 
-  FILE *fp = fopen (file_name, "rb");
+  FILE *fp;
+  int nFD;
+  int n;
+  if (sscanf (file_name, "/:FD:/%d%n", &nFD, &n) == 1 && file_name[n] == '\0')
+  {
+    lseek (nFD, 0, SEEK_SET);
+    fp = fdopen (dup (nFD), "rb");
+  }
+  else
+  {
+    fp = fopen (file_name, "rb");
+  }
+
   if (unlikely (!fp)) goto fread_fail_without_close;
 
   while (!feof (fp))