Changeset 134 for trunk/src/sh_tiger0.c
- Timestamp:
- Oct 26, 2007, 12:20:10 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_tiger0.c
r133 r134 100 100 */ 101 101 102 static sh_byte buffer[PRIV_MAX + 72]; 102 /* static sh_byte buffer[PRIV_MAX + 72]; */ 103 103 104 104 #if defined(TIGER_64_BIT) … … 121 121 UINT64 bcount = 0; 122 122 123 static int lockflag = SL_FALSE;123 char * buffer = SH_ALLOC(PRIV_MAX + 72); 124 124 125 125 unsigned long pages_read; … … 176 176 MSG_E_ACCESS, (long) euid, tmp); 177 177 SH_FREE(tmp); 178 SH_FREE(buffer); 178 179 SL_RETURN( NULL, _("sh_tiger_hash_val")); 179 180 } 180 181 181 SH_MUTEX_LOCK(mutex_skey);182 182 #if defined(HAVE_MLOCK) && !defined(HAVE_BROKEN_MLOCK) 183 if ( (lockflag == SL_FALSE) && (skey->mlock_failed == SL_FALSE))183 if (skey->mlock_failed == SL_FALSE) 184 184 { 185 lockflag = SL_TRUE;186 185 if ( (-1) == sh_unix_mlock(FIL__, __LINE__, 187 186 (char *)buffer, 188 187 (PRIV_MAX)*sizeof(sh_byte))) 189 skey->mlock_failed = SL_TRUE; 188 { 189 SH_MUTEX_LOCK_UNSAFE(mutex_skey); 190 skey->mlock_failed = SL_TRUE; 191 SH_MUTEX_UNLOCK_UNSAFE(mutex_skey); 192 } 190 193 } 191 194 #else 192 if ( lockflag == SL_FALSE &&skey->mlock_failed == SL_FALSE)195 if (skey->mlock_failed == SL_FALSE) 193 196 { 194 lockflag = SL_TRUE;197 SH_MUTEX_LOCK_UNSAFE(mutex_skey); 195 198 skey->mlock_failed = SL_TRUE; 199 SH_MUTEX_UNLOCK_UNSAFE(mutex_skey); 196 200 } 197 201 #endif 198 SH_MUTEX_UNLOCK(mutex_skey);199 202 200 203 #ifdef TIGER_DBG … … 216 219 { 217 220 if (sig_termfast == 1) { 221 sh_unix_munlock((char *)buffer, (PRIV_MAX)*sizeof(sh_byte)); 222 SH_FREE(buffer); 218 223 SL_RETURN( NULL, _("sh_tiger_hash_val")); 219 224 } … … 234 239 memset (buffer, 0, PRIV_MAX); 235 240 241 sh_unix_munlock((char *)buffer, (PRIV_MAX)*sizeof(sh_byte)); 242 SH_FREE(buffer); 236 243 SL_RETURN( NULL, _("sh_tiger_hash_val")); 237 244 } … … 278 285 memset (bbuf, 0, 64); 279 286 memset (buffer, 0, PRIV_MAX); 280 287 sh_unix_munlock((char *)buffer, (PRIV_MAX)*sizeof(sh_byte)); 288 SH_FREE(buffer); 281 289 SL_RETURN( NULL, _("sh_tiger_hash_val")); 282 290 } … … 364 372 if (what == TIGER_FILE) 365 373 (void) sl_close (fd); 366 374 sh_unix_munlock((char *)buffer, (PRIV_MAX)*sizeof(sh_byte)); 375 SH_FREE(buffer); 367 376 SL_RETURN( res, _("sh_tiger_hash_val")); 368 377 } … … 370 379 if (what == TIGER_DATA && filename != NULL) 371 380 { 372 tiger(TIGER_CAST filename, (sh_word32) Length, res); 381 tiger(TIGER_CAST filename, (sh_word32) Length, res); 382 sh_unix_munlock((char *)buffer, (PRIV_MAX)*sizeof(sh_byte)); 383 SH_FREE(buffer); 373 384 SL_RETURN(res, _("sh_tiger_hash_val")); 374 385 } 386 sh_unix_munlock((char *)buffer, (PRIV_MAX)*sizeof(sh_byte)); 387 SH_FREE(buffer); 375 388 SL_RETURN( NULL, _("sh_tiger_hash_val")); 376 389 }
Note:
See TracChangeset
for help on using the changeset viewer.