Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Jan 1998 15:07:55 +0200 (SAT)
From:      Jacques Fourie <jacques@oskar.nanoteq.co.za>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   Unable to open /dev/urandom when compiling with -lc_r
Message-ID:  <199801191307.PAA01429@oskar.nanoteq.co.za>

next in thread | raw e-mail | index | archive | help
Hi

I am unable to open /dev/urandom when compiling with -lc_r. The open() call
returns -1, with errno set to 25 (ENOTTY). Here is an example program : 


/* Doesn't Work when compiled with gcc rndtest.c -o rndtest -D_THREAD_SAFE -lc_r */
/* Works when compiled without the threaded c lib. */

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <fcntl.h>
#include <errno.h>

main()
{
  int fd = -1;

  if((fd=open("/dev/urandom",O_RDONLY,0))==-1) {
    printf("Error : %d\n",errno);
    exit(1);
  }

  exit(0);
}

Any ideas ??
Jacques

/***********************************************************************\
| Jacques Fourie                                                        |
| Network System Engineer                                               |
| Nanoteq  									                                            |	
| Tel: +27-12-6651338        Email: jf@nanoteq.com       P.O Box 7991   |
| Fax: +27-12-6651343					                           Centurion	    |
|			                                    			         0046 			    |
|                                          							 South Africa   |
\***********************************************************************/
|Standard disclaimer:                              |
|All views expressed here are my own.						   |
|--------------------------------------------------|




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801191307.PAA01429>