Check results from fopen.

Check results from fopen.
This commit is contained in:
Robert Norris 1998-05-20 10:19:21 +00:00
parent e06292f5b3
commit c7b0ae2571
3 changed files with 24 additions and 6 deletions

View File

@ -287,7 +287,10 @@ save_image (char *filename,
else if (pid == 0)
{
f = fopen(filename,"w");
if (!(f = fopen(filename,"w"))){
g_warning("gz: fopen failed: %s\n", g_strerror(errno));
_exit(127);
}
/* make stdout for this process be the output file */
if (-1 == dup2(fileno(f),fileno(stdout)))
@ -347,7 +350,10 @@ load_image (char *filename, gint32 run_mode)
else if (pid == 0) /* child process */
{
FILE* f;
f = fopen(tmpname,"w");
if (!(f = fopen(tmpname,"w"))){
g_warning("gz: fopen failed: %s\n", g_strerror(errno));
_exit(127);
}
/* make stdout for this child process be the temp file */
if (-1 == dup2(fileno(f),fileno(stdout)))

View File

@ -287,7 +287,10 @@ save_image (char *filename,
else if (pid == 0)
{
f = fopen(filename,"w");
if (!(f = fopen(filename,"w"))){
g_warning("gz: fopen failed: %s\n", g_strerror(errno));
_exit(127);
}
/* make stdout for this process be the output file */
if (-1 == dup2(fileno(f),fileno(stdout)))
@ -347,7 +350,10 @@ load_image (char *filename, gint32 run_mode)
else if (pid == 0) /* child process */
{
FILE* f;
f = fopen(tmpname,"w");
if (!(f = fopen(tmpname,"w"))){
g_warning("gz: fopen failed: %s\n", g_strerror(errno));
_exit(127);
}
/* make stdout for this child process be the temp file */
if (-1 == dup2(fileno(f),fileno(stdout)))

View File

@ -287,7 +287,10 @@ save_image (char *filename,
else if (pid == 0)
{
f = fopen(filename,"w");
if (!(f = fopen(filename,"w"))){
g_warning("gz: fopen failed: %s\n", g_strerror(errno));
_exit(127);
}
/* make stdout for this process be the output file */
if (-1 == dup2(fileno(f),fileno(stdout)))
@ -347,7 +350,10 @@ load_image (char *filename, gint32 run_mode)
else if (pid == 0) /* child process */
{
FILE* f;
f = fopen(tmpname,"w");
if (!(f = fopen(tmpname,"w"))){
g_warning("gz: fopen failed: %s\n", g_strerror(errno));
_exit(127);
}
/* make stdout for this child process be the temp file */
if (-1 == dup2(fileno(f),fileno(stdout)))