diff --git a/hw/atapi-pt.c b/hw/atapi-pt.c
-index 09cf6bb..f0b71ca 100644
+index 09cf6bb..aed333d 100644
--- a/hw/atapi-pt.c
+++ b/hw/atapi-pt.c
@@ -29,7 +29,6 @@ static int debug_enabled=-1;
+
+static int lock_fd = -1, we_have_lock = 0;
+
-+int open_lock_file(void)
++static int open_lock_file(void)
+{
+ lock_fd = open( IDE_ATAPI_PT_EXCLUSIVE_CD_FILE, O_RDWR | O_CREAT, 0666);
+ return (lock_fd<0) ? 1:0;
+}
+
+
-+int get_atapi_pt_lock_state(void)
++static int get_atapi_pt_lock_state(void)
+{
+ struct flock lock = {0};
+
+ return ATAPI_PT_LOCK_STATE_LOCKED_BY_OTHER;
+}
+
-+int get_atapi_pt_lock(void)
++static int get_atapi_pt_lock(void)
+{
+ struct flock lock = {0};
+
+ return 0;
+}
+
-+int release_atapi_pt_lock(void)
++static int release_atapi_pt_lock(void)
+{
+ struct flock lock = {0};
+
{
uint8_t sense[18] = {0x70, 0, 2, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0x3a, 1, 0, 0, 0, 0};
-@@ -1118,17 +1194,14 @@ static void ide_atapi_pt_cmd(IDEState *s)
+@@ -1118,17 +1194,17 @@ static void ide_atapi_pt_cmd(IDEState *s)
cmd_code == GPCMD_WRITE_10 || cmd_code == GPCMD_WRITE_12 || cmd_code == GPCMD_WRITE_AND_VERIFY_10 ||
cmd_code == GPCMD_WRITE_BUFFER)
{
- close(fd);
+ if(get_atapi_pt_lock()) {
+ DEBUG_PRINTF("Could not open CD exclusivity lock file for writing\n");
++#if 0
++ // FIXME XXX - make this throw an error
+ memcpy(&s->atapi_pt.sense, sense, 18);
+ ide_atapi_pt_set_error(s, sense[2], sense[12], sense[13], 0x70);
+ pthread_mutex_unlock(&s->atapi_pt.sgio_mutex);
+ return;
++#endif
}
}