Hi. I made a fix which appears to work (I ran some tests with my updated  
build on a 2.6.12 kernel, vs the original debian build (on a pre-2.6.12  
kernel) and the output (screen & files) appear to be the same.  
  
But I don't know the Quelcom logic well enough to ensure this fix won't  
break something else. Please check this. 
 
David.

diff -aruN quelcom-0.4.0-orig/lib/qfile.cc quelcom-0.4.0/lib/qfile.cc
--- quelcom-0.4.0-orig/lib/qfile.cc	2001-02-23 14:29:12.000000000 +0200
+++ quelcom-0.4.0/lib/qfile.cc	2005-10-05 09:18:51.000000000 +0200
@@ -62,9 +62,13 @@
  
   size = stat.st_size;
 
-  if ((map=(caddr_t)mmap((caddr_t)0,size,mapflags,MAP_SHARED,fd,0))==MAP_FAILED) {
-    close(fd);
-    throw qexception(__PRETTY_FUNCTION__,strerror(errno));
+  // Since Linux kernel 2.6.12, 0-length mmaps fail:
+  map=NULL; // map will remain NULL if the size is 0
+  if (size>0) {
+    if ((map=(caddr_t)mmap((caddr_t)0,size,mapflags,MAP_SHARED,fd,0))==MAP_FAILED) {
+      close(fd);
+      throw qexception(__PRETTY_FUNCTION__,strerror(errno));
+    }
   }
 
 #ifdef QVERBOSE

Reply via email to