diff -c -r capi4hylafax-01.02.02/ChangeLog capi4hylafax-01.02.02-jo/ChangeLog
*** capi4hylafax-01.02.02/ChangeLog	2003-01-17 00:00:00.000000000 +0100
--- capi4hylafax-01.02.02-jo/ChangeLog	2004-02-21 12:19:25.000000000 +0100
***************
*** 1,3 ****
--- 1,7 ----
+ 2004-02-21  Joerg Sommrey
+ 	* fixed string lengths for output to xferfaxlog in FaxBase.cpp
+ 	* corrected some spelling in FaxBase.cpp
+ 	* replaced semaphore in sendmain.cpp by pthread_cond, sem_wait had spourious wakeups from SIGALRM in 2.6 kernels 
  2003-01-08  Michael Rolf
  	* Workaround for the AVM C4 that it does not cut off the end of faxes anymore.
  2002-12-10  Michael Rolf
diff -c -r capi4hylafax-01.02.02/src/convert/BasicFax.cpp capi4hylafax-01.02.02-jo/src/convert/BasicFax.cpp
*** capi4hylafax-01.02.02/src/convert/BasicFax.cpp	2003-01-17 00:00:00.000000000 +0100
--- capi4hylafax-01.02.02-jo/src/convert/BasicFax.cpp	2004-02-21 11:56:52.000000000 +0100
***************
*** 229,235 ****
                        pDestination->GetPointer());
          } else {
              flock (fd, LOCK_EX);
!             if ((tUInt)write (fd, xferline.GetPointer(), xferline.GetSize()) != xferline.GetSize()) {
                  WriteLog (LOG_ERR, "Can't write xferfaxlog accounting record (dest=%s)!",
                            pDestination->GetPointer());
              }
--- 229,235 ----
                        pDestination->GetPointer());
          } else {
              flock (fd, LOCK_EX);
!             if ((tUInt)write (fd, xferline.GetPointer(), xferline.GetLen()) != xferline.GetLen()) {
                  WriteLog (LOG_ERR, "Can't write xferfaxlog accounting record (dest=%s)!",
                            pDestination->GetPointer());
              }
***************
*** 603,609 ****
          case iWrn_Filter_PageEnd:
              m_PageCount++;
              m_sSffFilter.PutPageHeader (vFalse);
!             WriteLog (LOG_INFO, "Page %d was sended.\n", m_PageCount);
              break;
          case iWrn_Filter_LastPageEnd: {
              tBool isFinish = vTrue;
--- 603,609 ----
          case iWrn_Filter_PageEnd:
              m_PageCount++;
              m_sSffFilter.PutPageHeader (vFalse);
!             WriteLog (LOG_INFO, "Page %d was sent.\n", m_PageCount);
              break;
          case iWrn_Filter_LastPageEnd: {
              tBool isFinish = vTrue;
***************
*** 624,630 ****
                          fret = iErr_File_NotExist;
                      }
                  } else if (m_sTifFilter.Open (m_pCurSendFile->GetPointer()) == vTrue) {
!                     WriteLog (LOG_INFO, "Page %d was sended.\n", m_PageCount);
                      tUInt Resolution = (m_VResolution) ? m_VResolution :
                                      (m_sTifFilter.GetYRes()) ? m_sTifFilter.GetYRes() : 196;
                      m_sSffFilter.SetVRes ((Resolution >= 196) ? 1 : 0);
--- 624,630 ----
                          fret = iErr_File_NotExist;
                      }
                  } else if (m_sTifFilter.Open (m_pCurSendFile->GetPointer()) == vTrue) {
!                     WriteLog (LOG_INFO, "Page %d was sent.\n", m_PageCount);
                      tUInt Resolution = (m_VResolution) ? m_VResolution :
                                      (m_sTifFilter.GetYRes()) ? m_sTifFilter.GetYRes() : 196;
                      m_sSffFilter.SetVRes ((Resolution >= 196) ? 1 : 0);
***************
*** 641,647 ****
              dprint ("i_LastPageEnd-Recv (isFinish=%x) ", isFinish);
              if (isFinish == vTrue) {
                  if (m_format != FaxFormat_G3) {
!                     WriteLog (LOG_INFO, "Page %d was sended. - Last Page!\n", m_PageCount);
                  }
                  m_finishedFaxFile++;
                  return fret;
--- 641,647 ----
              dprint ("i_LastPageEnd-Recv (isFinish=%x) ", isFinish);
              if (isFinish == vTrue) {
                  if (m_format != FaxFormat_G3) {
!                     WriteLog (LOG_INFO, "Page %d was sent. - Last Page!\n", m_PageCount);
                  }
                  m_finishedFaxFile++;
                  return fret;
diff -c -r capi4hylafax-01.02.02/src/faxsend/sendmain.cpp capi4hylafax-01.02.02-jo/src/faxsend/sendmain.cpp
*** capi4hylafax-01.02.02/src/faxsend/sendmain.cpp	2003-01-17 00:00:00.000000000 +0100
--- capi4hylafax-01.02.02-jo/src/faxsend/sendmain.cpp	2004-02-21 12:15:00.000000000 +0100
***************
*** 18,26 ****
  
  #include <stdio.h>
  #include <stdlib.h>
- #include <semaphore.h>
  #include <unistd.h>
  #include <syslog.h>
  #include "faxsend.h"
  #include "ConfAssi.h"
  #include "FilePars.h"
--- 18,26 ----
  
  #include <stdio.h>
  #include <stdlib.h>
  #include <unistd.h>
  #include <syslog.h>
+ #include <pthread.h>
  #include "faxsend.h"
  #include "ConfAssi.h"
  #include "FilePars.h"
***************
*** 34,46 ****
  /*---------------------------------------------------------------------------*\
  \*---------------------------------------------------------------------------*/
  
! static sem_t syncsema;
  
  /*---------------------------------------------------------------------------*\
  \*---------------------------------------------------------------------------*/
  
  void FinishFunc (void) {
!     sem_post (&syncsema);
  }
  
  /*===========================================================================*\
--- 34,49 ----
  /*---------------------------------------------------------------------------*\
  \*---------------------------------------------------------------------------*/
  
! static int synccondvar = 0;
! static pthread_cond_t synccond = PTHREAD_COND_INITIALIZER;
! static pthread_mutex_t synccond_mutex = PTHREAD_MUTEX_INITIALIZER;
  
  /*---------------------------------------------------------------------------*\
  \*---------------------------------------------------------------------------*/
  
  void FinishFunc (void) {
!     synccondvar = 1;
!     pthread_cond_signal(&synccond);
  }
  
  /*===========================================================================*\
***************
*** 424,439 ****
          return 13;
      }
  
!     sem_init (&syncsema, 0, 0);
      if (fs.Send (TelNumber.GetPointer(),
                   &FaxFileList,
                   Resolution,
                   JobID,
                   &commID,
                   &PollStr) == i_Okay) {
!         sem_wait (&syncsema);
!     }
!     sem_destroy (&syncsema);
      dprint ("fs.exitState=%x ", fs.exitState);
      if (format == FaxFormat_Hylafax) {
          WriteQFile (argv[optind], commID, &fs, &statustext);
--- 427,446 ----
          return 13;
      }
  
!     pthread_mutex_lock(&synccond_mutex);
      if (fs.Send (TelNumber.GetPointer(),
                   &FaxFileList,
                   Resolution,
                   JobID,
                   &commID,
                   &PollStr) == i_Okay) {
! 	do {
!           pthread_cond_wait(&synccond, &synccond_mutex);
!         } while(synccondvar == 0);
!     }
!     pthread_mutex_unlock(&synccond_mutex);
!     pthread_mutex_destroy(&synccond_mutex);
!     pthread_cond_destroy(&synccond);
      dprint ("fs.exitState=%x ", fs.exitState);
      if (format == FaxFormat_Hylafax) {
          WriteQFile (argv[optind], commID, &fs, &statustext);
