diff -urEb e2fsprogs-1.44.5.orig/lib/uuid/gen_uuid.c e2fsprogs-1.44.5/lib/uuid/gen_uuid.c
--- e2fsprogs-1.44.5.orig/lib/uuid/gen_uuid.c	2020-11-24 15:47:40.950897761 +0100
+++ e2fsprogs-1.44.5/lib/uuid/gen_uuid.c	2020-11-24 15:48:51.234732050 +0100
@@ -147,12 +147,14 @@
 		fd = open("/dev/urandom", O_RDONLY);
 		if (fd == -1)
 			fd = open("/dev/random", O_RDONLY | O_NONBLOCK);
+#if !defined(__EMSCRIPTEN__)  // By SJO for Stone
 		if (fd >= 0) {
 			i = fcntl(fd, F_GETFD);
 			if (i >= 0)
 				fcntl(fd, F_SETFD, i | FD_CLOEXEC);
 		}
 #endif
+#endif
 		srand(((unsigned)getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
 #ifdef DO_JRAND_MIX
 		jrand_seed[0] = getpid() ^ (tv.tv_sec & 0xFFFF);
diff -urEb e2fsprogs-1.44.5.orig/lib/uuid/uuid.h.in e2fsprogs-1.44.5/lib/uuid/uuid.h.in
--- e2fsprogs-1.44.5.orig/lib/uuid/uuid.h.in	2020-11-24 15:47:40.950897761 +0100
+++ e2fsprogs-1.44.5/lib/uuid/uuid.h.in	2020-11-24 15:48:00.946849227 +0100
@@ -35,6 +35,20 @@
 #ifndef _UUID_UUID_H
 #define _UUID_UUID_H
 
+
+#if defined(__APPLE__)
+// This patch defines the "uuid_string_t" type on OS X, which is
+// required if linking against Cocoa (this occurs in Stone of Orthanc)
+#include <sys/_types.h>
+#include <sys/_types/_uuid_t.h>
+
+#ifndef _UUID_STRING_T
+#define _UUID_STRING_T
+typedef __darwin_uuid_string_t  uuid_string_t;
+#endif /* _UUID_STRING_T */
+#endif
+
+
 #include <sys/types.h>
 #ifndef _WIN32
 #include <sys/time.h>
