diff --git a/sbin/rcorder/rcorder.c b/sbin/rcorder/rcorder.c index 951bcb630ced..fd96553638b4 100644 --- a/sbin/rcorder/rcorder.c +++ b/sbin/rcorder/rcorder.c @@ -1,4 +1,4 @@ -/* $NetBSD: rcorder.c,v 1.2 2000/04/26 05:12:06 thorpej Exp $ */ +/* $NetBSD: rcorder.c,v 1.3 2000/05/09 04:21:16 enami Exp $ */ /* * Copyright (c) 1998, 1999 Matthew R. Green @@ -34,6 +34,7 @@ */ #include +#include #include #include @@ -399,6 +400,7 @@ crunch_file(filename) int require_flag, provide_flag, before_flag, directive_flag; filenode *node; char delims[3] = { '\\', '\\', '\0' }; + struct stat st; directive_flag = 0; @@ -407,6 +409,16 @@ crunch_file(filename) return; } + if (fstat(fileno(fp), &st) == -1) { + warn("could not stat %s", filename); + return; + } + + if (!S_ISREG(st.st_mode)) { + warnx("%s is not a file", filename); + return; + } + node = filenode_new(filename); /*