Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/rcorder Crunch only regular files and warn others.



details:   https://anonhg.NetBSD.org/src/rev/f9ed3d559781
branches:  trunk
changeset: 485941:f9ed3d559781
user:      enami <enami%NetBSD.org@localhost>
date:      Tue May 09 04:21:16 2000 +0000

description:
Crunch only regular files and warn others.

diffstat:

 sbin/rcorder/rcorder.c |  14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diffs (42 lines):

diff -r f1c1243496fd -r f9ed3d559781 sbin/rcorder/rcorder.c
--- a/sbin/rcorder/rcorder.c    Tue May 09 00:56:21 2000 +0000
+++ b/sbin/rcorder/rcorder.c    Tue May 09 04:21:16 2000 +0000
@@ -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 @@
        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 @@
                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);
 
        /*



Home | Main Index | Thread Index | Old Index