068e729
diff -up ghostscript-9.06/base/gsicc_manage.c.iccprofiles-initdir ghostscript-9.06/base/gsicc_manage.c
068e729
--- ghostscript-9.06/base/gsicc_manage.c.iccprofiles-initdir	2012-08-09 13:58:22.102364807 +0100
068e729
+++ ghostscript-9.06/base/gsicc_manage.c	2012-08-09 14:09:24.495864641 +0100
068e729
@@ -38,6 +38,7 @@
068e729
 #include "gsicc_create.h"
068e729
 #include "gpmisc.h"
068e729
 #include "gxdevice.h"
068e729
+#include "gxiodev.h"
9930de3
 
068e729
 #define ICC_HEADER_SIZE 128
068e729
 
068e729
@@ -2176,8 +2177,21 @@ gs_currenticcdirectory(const gs_state *
068e729
     const gs_lib_ctx_t *lib_ctx = pgs->memory->gs_lib_ctx;
2982191
 
2982191
     if (lib_ctx->profiledir == NULL) {
2982191
-        pval->data = (const byte *)rfs;
2982191
-        pval->size = strlen(rfs);
2982191
+	int have_rom_device = 0;
2982191
+	int i;
9930de3
+
2982191
+	for (i = 0; i < gx_io_device_table_count; i++) {
068e729
+	    const gx_io_device *iodev = lib_ctx->io_device_table[i];
2982191
+	    const char *dname = iodev->dname;
9930de3
+
068e729
+	    if (dname && strlen(dname) == 5 && !memcmp("%rom%", dname, 5)) {
2982191
+		have_rom_device = 1;
2982191
+		break;
2982191
+	    }
2982191
+	}
2982191
+
068e729
+        pval->data = (const byte *)(have_rom_device ? rfs : "");
068e729
+        pval->size = strlen((const char *)pval->data);
068e729
         pval->persistent = true;
2982191
     } else {
2982191
         pval->data = (const byte *)(lib_ctx->profiledir);