Changeset 1750 for trunk/dll/avl.c


Ignore:
Timestamp:
Mar 1, 2014, 2:55:57 PM (11 years ago)
Author:
John Small
Message:

Ticket #524: Made "searchapath" thread-safe. Function names and signatures were changed.

So calls to these functions, direct and indirect, had to be changed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/avl.c

    r1625 r1750  
    4343  26 Aug 11 GKY Add the code to correctly format the date time strings for tar.gz archives
    4444                viewed using tar 1.15+
     45  01 Mar 14 JBS Ticket #524: Made "searchapath" thread-safe. Function names and signatures were changed.
     46                So calls to these functions had to be changed.
    4547
    4648***********************************************************************/
     
    7678#include "wrappers.h"                   // xfgets
    7779#include "strips.h"                     // bstrip
    78 #include "srchpath.h"                   // searchpath
     80#include "srchpath.h"                   // Search*Path*ForFile
    7981#include "stristr.h"                    // stristr
    8082#include "delims.h"                     // to_delim
     
    376378  arcsigs_trailer_line_num = 0;
    377379
    378   //DosEnterCritSec(); //GKY 11-29-08
    379   DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
    380   psz = searchpath(PCSZ_ARCHIVERBB2);
    381   if (!psz || !*psz) {
     380  {
     381    CHAR szFullFilename[CCHMAXPATH];
     382
     383    DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
     384    if (SearchMultiplePathsForFile(PCSZ_ARCHIVERBB2, szFullFilename)) {
     385      DosReleaseMutexSem(hmtxFM2Globals);
     386      return -1;
     387    }
     388    stat(szFullFilename, &Archiverbb2Stats);
     389    fp = xfsopen(szFullFilename, moder, SH_DENYWR, pszSrcFile, __LINE__, TRUE);
    382390    DosReleaseMutexSem(hmtxFM2Globals);
    383     //DosExitCritSec();
    384     return -1;
     391    if (!fp)
     392      return -2;
     393    strcpy(archiverbb2, szFullFilename);                // Remember full path
    385394  }
    386   stat(psz, &Archiverbb2Stats);
    387   fp = xfsopen(psz, moder, SH_DENYWR, pszSrcFile, __LINE__, TRUE);
    388   DosReleaseMutexSem(hmtxFM2Globals);
    389   //DosExitCritSec();
    390   if (!fp)
    391     return -2;
    392   strcpy(archiverbb2, psz);             // Remember full path
    393395
    394396  cur_line_num = 0;
     
    790792      struct stat Buffer;
    791793
    792       stat(searchpath(PCSZ_ARCHIVERBB2), &Buffer);
     794//      stat(searchpath(PCSZ_ARCHIVERBB2), &Buffer);
     795      stat(archiverbb2, &Buffer);   // jbs: Re-use full name set by load_achivers
    793796      if (Archiverbb2Stats.st_size != Buffer.st_size ||
    794           Archiverbb2Stats.st_mtime != Buffer.st_mtime)       
    795         if (saymsg(MB_YESNO,                                   
     797          Archiverbb2Stats.st_mtime != Buffer.st_mtime)
     798        if (saymsg(MB_YESNO,
    796799                   hwnd,
    797800                   GetPString(IDS_ADCHANGESONDISKTEXT),
     
    887890                   GetPString(IDS_ADCHANGESINMEMTEXT),
    888891                   GetPString(IDS_ADREWRITETEXT), NullStr) == MBID_YES) {
    889           PSZ ab2 = searchpath(PCSZ_ARCHIVERBB2);       // Rewrite without prompting
    890 
    891           rewrite_archiverbb2(ab2);
     892// 524    PSZ ab2 = searchpath(PCSZ_ARCHIVERBB2);       // Rewrite without prompting
     893
     894          rewrite_archiverbb2(archiverbb2);  // jbs: Re-use full path set by load_archivers
    892895        }
    893896      }
Note: See TracChangeset for help on using the changeset viewer.