rand_s isn't supported on older Visual C compilers
authorAsanka Herath <asanka@secure-endpoints.com>
Wed, 12 Aug 2009 17:57:11 +0000 (13:57 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Wed, 12 Aug 2009 18:20:49 +0000 (11:20 -0700)
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 <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/afsd/rpc_srvsvc.c

index 5bcc5f2..1cb809d 100644 (file)
@@ -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