home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
400-499
/
ff473.lzh
/
CNewsSrc
/
cnews_src.lzh
/
libcnews
/
fopenclex.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-05-29
|
575b
|
32 lines
/*
* fopen and set close-on-exec (to avoid leaking descriptors into children)
*/
#include <stdio.h>
#ifdef unix
# include <sys/types.h>
#endif /* unix */
#include "news.h"
FILE *
fopenwclex(name, mode) /* open name; close-on-exec if OK, else warning */
char *name, *mode;
{
register FILE *fp;
if ((fp = fopenclex(name, mode)) == NULL)
warning("can't open `%s'", name);
return fp;
}
FILE *
fopenclex(file, mode) /* open file and if OK, close-on-exec */
char *file, *mode;
{
register FILE *fp;
if ((fp = fopen(file, mode)) != NULL)
fclsexec(fp);
return fp;
}