Crunch only regular files and warn others.

This commit is contained in:
enami 2000-05-09 04:21:16 +00:00
parent 9f48bba3ae
commit 46f4baf5f4
1 changed files with 13 additions and 1 deletions

View File

@ -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 <sys/types.h>
#include <sys/stat.h>
#include <err.h>
#include <stdio.h>
@ -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);
/*