--- motion-3.2.1/netcam.c	2005-05-23 23:03:00.000000000 +0200
+++ motion-3.2.1-netcam/netcam.c	2005-05-27 01:50:42.000000000 +0200
@@ -98,6 +98,8 @@ int netcam_stream_read(struct context *)
 int netcam_start(struct context *);
 unsigned char *netcam_next(struct context *, char *);
 
+extern int errno;
+
 /*
  * finds the matched part of the regular expression 
  * 
@@ -372,8 +374,8 @@ void netcam_cleanup(struct context *cnt)
 	pthread_mutex_unlock(&netcam->mutex);
 
 	pthread_attr_destroy(&netcam->thread_attr);
-	pthread_cond_destroy(&netcam->which_cond);
-	pthread_cond_destroy(&netcam->dirty_cond);
+//	pthread_cond_destroy(&netcam->which_cond);
+//	pthread_cond_destroy(&netcam->dirty_cond);
 	pthread_mutex_destroy(&netcam->image[0].mutex);
 	pthread_mutex_destroy(&netcam->image[1].mutex);
 	pthread_mutex_destroy(&netcam->mutex);
@@ -942,6 +944,7 @@ int netcam_single_read(struct context *c
 		timeout.tv_sec = now.tv_sec + COND_WHICH_TIMEOUT;
 		timeout.tv_nsec = now.tv_usec * 1000;
 		pthread_cond_timedwait(&netcam->which_cond, &netcam->mutex, &timeout);
+	
 		pthread_mutex_unlock(&netcam->mutex);
 
 		pthread_mutex_lock(&netcam->image[which].mutex);
