$OpenBSD: patch-import_tcxmlcheck_c,v 1.1.1.1 2004/06/18 18:56:48 sturm Exp $
--- import/tcxmlcheck.c.orig	2004-04-29 19:48:45.000000000 -0700
+++ import/tcxmlcheck.c	2004-04-29 19:48:57.000000000 -0700
@@ -126,10 +126,10 @@ int main(int argc, char *argv[])
 {
 
 	vob_t s_vob,*p_vob;
-	char s_cmd,*p_in_v_file="/dev/stdin",*p_in_a_file=NULL,*p_audio_tmp=NULL,*p_video_tmp=NULL;
+	char *p_in_v_file="/dev/stdin",*p_in_a_file=NULL,*p_audio_tmp=NULL,*p_video_tmp=NULL;
 	pid_t s_pid;
 	int s_bin_dump=0,s_type_check=VIDEO_MODE|AUDIO_MODE,s_shmem=0;
-	int s_shm,s_rc;
+	int s_shm,s_rc,s_cmd;
 	key_t s_key=0x00112233;
 	
 	//proper initialization
@@ -193,6 +193,9 @@ int main(int argc, char *argv[])
 	
 	if ((s_bin_dump) && (s_shmem))
 	{
+		if((s_shm = shmget(s_key, 0, 0600)) != -1)
+			shmctl(s_shm, IPC_RMID, NULL);
+
 		if((p_read(STDIN_FILENO, (char *) &s_vob, sizeof(vob_t))) != sizeof(vob_t))
 		{
 			fprintf(stderr,"(%s) Error reading data from stdin\n",EXE);
@@ -205,7 +208,7 @@ int main(int argc, char *argv[])
 		}
 		if ((p_vob=(vob_t *)shmat(s_shm,NULL,0)) == (vob_t *)-1)
 		{
-			shmctl( s_shm, IPC_RMID, p_vob );
+			shmctl( s_shm, IPC_RMID, NULL );
 			(int) shmdt(p_vob);
 			fprintf(stderr,"(%s) Cannot attach shared memory segment\n",EXE);
 			exit(1);
@@ -223,13 +226,13 @@ int main(int argc, char *argv[])
 		}
 		if ((p_vob=(vob_t *)shmat(s_shm,NULL,0)) == (vob_t *)-1)
 		{
-			shmctl( s_shm, IPC_RMID, p_vob );
+			shmctl( s_shm, IPC_RMID, NULL );
 			(int) shmdt(p_vob);
 			fprintf(stderr,"(%s) Cannot attach shared memory segment\n",EXE);
 			exit(1);
 		}
 		memcpy((char *)&s_vob,(char *) p_vob, sizeof(vob_t));
-		shmctl( s_shm, IPC_RMID, p_vob );
+		shmctl( s_shm, IPC_RMID, NULL );
 		(int) shmdt(p_vob);
 		p_video_tmp=s_vob.video_in_file;
 		p_audio_tmp=s_vob.audio_in_file;
