From: Asanka Herath Date: Wed, 12 Aug 2009 17:57:11 +0000 (-0400) Subject: rand_s isn't supported on older Visual C compilers X-Git-Tag: openafs-devel-1_5_62~52 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=9f2eb69899f1c4dba6671fe784ea2dd61e75a7eb;p=packages%2Fo%2Fopenafs.git rand_s isn't supported on older Visual C compilers We still support building on Visual Studio 2003 where rand_s() is not available. If we are building on a Visual C compiler prior to version 15.00, failover to srand()/rand() instead of using rand_s(). Reviewed-on: http://gerrit.openafs.org/306 Tested-by: Jeffrey Altman Reviewed-by: Jeffrey Altman --- diff --git a/src/WINNT/afsd/rpc_srvsvc.c b/src/WINNT/afsd/rpc_srvsvc.c index 5bcc5f255..1cb809d9a 100644 --- a/src/WINNT/afsd/rpc_srvsvc.c +++ b/src/WINNT/afsd/rpc_srvsvc.c @@ -330,7 +330,12 @@ RPC_SRVSVC_Init(void) { lock_InitializeMutex(&shareEnum_mx, "NetrShareEnum", 0); shareEnumQ = NULL; +#if _MSC_VER < 1500 + srand((unsigned) time( NULL )); + shareEnum_next_handle = rand(); +#else rand_s(&shareEnum_next_handle); +#endif } void