home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
300-399
/
ff319.lzh
/
CNewsSrc
/
cnews.src.lzh
/
libcnews
/
fopenclex.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-07-03
|
544b
|
30 lines
/*
* fopen and set close-on-exec (to avoid leaking descriptors into children)
*/
#include <stdio.h>
#include <sys/types.h>
#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;
}