Changeset 144 for trunk/src/slib.c
- Timestamp:
- Oct 31, 2007, 11:33:13 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/slib.c
r137 r144 55 55 #define SH_NEED_PWD_GRP 1 56 56 #include "sh_static.h" 57 #include "sh_pthread.h" 57 58 58 59 #undef FIL__ … … 1514 1515 static SL_OFILE * ofiles[MAXFD]; 1515 1516 1517 SH_MUTEX_STATIC(mutex_ticket, PTHREAD_MUTEX_INITIALIZER); 1516 1518 1517 1519 static unsigned int nonce_counter = TOFFSET; … … 1522 1524 unsigned int high; /* index */ 1523 1525 unsigned int low; /* nonce */ 1526 SL_TICKET retval = SL_EINTERNAL; 1524 1527 1525 1528 SL_ENTER(_("sl_create_ticket")); 1526 1529 1527 if (myindex >= MAXFD) 1528 SL_IRETURN (SL_EINTERNAL, _("sl_create_ticket"));1530 if (myindex >= MAXFD) 1531 goto out_ticket; 1529 1532 1530 1533 /* mask out the high bit and check that it is not used … … 1534 1537 1535 1538 if (high != myindex + TOFFSET) 1536 SL_IRETURN (SL_EINTERNAL, _("sl_create_ticket")); 1539 goto out_ticket; 1540 1541 SH_MUTEX_LOCK_UNSAFE(mutex_ticket); 1537 1542 1538 1543 low = nonce_counter & 0xffff; … … 1541 1546 */ 1542 1547 if ((low != nonce_counter++) || low == 0) 1543 SL_IRETURN (SL_EINTERNAL, _("sl_create_ticket"));1548 goto out_ticket; 1544 1549 1545 1550 /* Wrap around the nonce counter. … … 1549 1554 nonce_counter = TOFFSET; 1550 1555 1551 SL_RETURN ((SL_TICKET) ((high << 16) | low), _("sl_create_ticket")); 1556 retval = (SL_TICKET) ((high << 16) | low); 1557 1558 out_ticket: 1559 ; 1560 1561 SH_MUTEX_UNLOCK_UNSAFE(mutex_ticket); 1562 SL_RETURN (retval, _("sl_create_ticket")); 1552 1563 } 1553 1564
Note:
See TracChangeset
for help on using the changeset viewer.