From 9be756b54b3fcd864aab64b7777401ffe1349d92 Mon Sep 17 00:00:00 2001 From: Mike Silbersack Date: Thu, 19 Jun 2003 20:04:51 +0000 Subject: Fix a coredump that would occur when fdopen was unable to return a valid fd. PR: 49096 Submitted by: demon MFC after: 3 days --- usr.sbin/cron/cron/do_command.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'usr.sbin/cron') diff --git a/usr.sbin/cron/cron/do_command.c b/usr.sbin/cron/cron/do_command.c index 4b6fe330543c..0133fa4ed717 100644 --- a/usr.sbin/cron/cron/do_command.c +++ b/usr.sbin/cron/cron/do_command.c @@ -369,13 +369,14 @@ child_process(e, u) /*local*/{ register FILE *in = fdopen(stdout_pipe[READ_PIPE], "r"); - register int ch = getc(in); + register int ch; if (in == NULL) { warn("fdopen failed in child"); _exit(ERROR_EXIT); } + ch = getc(in); if (ch != EOF) { register FILE *mail; register int bytes = 1; -- cgit v1.3