Subject: Re: R_OpenSiteFile: Do not use a null ptr as filename in fopen (PR#312)
Date: Thu 04 Nov 1999 - 19:50:55 EST
On Thu, Nov 04, 1999 at 10:09:05AM +0100, email@example.com wrote:
> The reason is, that in unix/sys-common.c in R_OpenSiteFile() fopen
> is called with a null ptr as filename (because this is the outcome
> of getenv()).
> Although most compilers seem to interpret this as "file not found",
> this is an undefined behavior concerning to all C standards I could get
> hold of.
> A request in comp.lang.c gave the following response:
> Your program should crash. If you might get a NULL pointer as
> a filename, you should have a conditional statement to handle
> that case.
The same happens also under Windows where, for this reason,
'R_fopen' is defined as
FILE *R_fopen(const char *filename, const char *mode)
return (fopen(filename, mode));
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: firstname.lastname@example.org
This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:09 EST