1diff -urEb e2fsprogs-1.44.5.orig/lib/uuid/gen_uuid.c e2fsprogs-1.44.5/lib/uuid/gen_uuid.c
2--- e2fsprogs-1.44.5.orig/lib/uuid/gen_uuid.c	2020-11-24 15:47:40.950897761 +0100
3+++ e2fsprogs-1.44.5/lib/uuid/gen_uuid.c	2020-11-24 15:48:51.234732050 +0100
4@@ -147,12 +147,14 @@
5 		fd = open("/dev/urandom", O_RDONLY);
6 		if (fd == -1)
7 			fd = open("/dev/random", O_RDONLY | O_NONBLOCK);
8+#if !defined(__EMSCRIPTEN__)  // By SJO for Stone
9 		if (fd >= 0) {
10 			i = fcntl(fd, F_GETFD);
11 			if (i >= 0)
12 				fcntl(fd, F_SETFD, i | FD_CLOEXEC);
13 		}
14 #endif
15+#endif
16 		srand(((unsigned)getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
17 #ifdef DO_JRAND_MIX
18 		jrand_seed[0] = getpid() ^ (tv.tv_sec & 0xFFFF);
19diff -urEb e2fsprogs-1.44.5.orig/lib/uuid/uuid.h.in e2fsprogs-1.44.5/lib/uuid/uuid.h.in
20--- e2fsprogs-1.44.5.orig/lib/uuid/uuid.h.in	2020-11-24 15:47:40.950897761 +0100
21+++ e2fsprogs-1.44.5/lib/uuid/uuid.h.in	2020-11-24 15:48:00.946849227 +0100
22@@ -35,6 +35,20 @@
23 #ifndef _UUID_UUID_H
24 #define _UUID_UUID_H
25
26+
27+#if defined(__APPLE__)
28+// This patch defines the "uuid_string_t" type on OS X, which is
29+// required if linking against Cocoa (this occurs in Stone of Orthanc)
30+#include <sys/_types.h>
31+#include <sys/_types/_uuid_t.h>
32+
33+#ifndef _UUID_STRING_T
34+#define _UUID_STRING_T
35+typedef __darwin_uuid_string_t  uuid_string_t;
36+#endif /* _UUID_STRING_T */
37+#endif
38+
39+
40 #include <sys/types.h>
41 #ifndef _WIN32
42 #include <sys/time.h>
43