|
From: Hans-Bernhard B. <br...@us...> - 2003-04-29 14:08:49
|
Update of /cvsroot/cscope/cscope/src
In directory sc8-pr-cvs1:/tmp/cvs-serv23739/src
Modified Files:
crossref.c dir.c
Log Message:
Check against irregular files listed in cscope.files. S_IFREG-->S_ISREG.
Index: crossref.c
===================================================================
RCS file: /cvsroot/cscope/cscope/src/crossref.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** crossref.c 9 Jul 2001 14:00:25 -0000 1.11
--- crossref.c 29 Apr 2003 14:08:45 -0000 1.12
***************
*** 43,46 ****
--- 43,47 ----
#include <stdlib.h>
+ #include <sys/stat.h>
static char const rcsid[] = "$Id$";
***************
*** 93,97 ****
--- 94,106 ----
int entry_no; /* function level of the symbol */
int token; /* current token */
+ struct stat st;
+ if (! ((stat(srcfile, &st) == 0)
+ && S_ISREG(st.st_mode))) {
+ cannotopen(srcfile);
+ errorsfound = YES;
+ return;
+ }
+
entry_no = 0;
/* open the source file */
Index: dir.c
===================================================================
RCS file: /cvsroot/cscope/cscope/src/dir.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** dir.c 16 Mar 2002 15:20:27 -0000 1.17
--- dir.c 29 Apr 2003 14:08:45 -0000 1.18
***************
*** 160,164 ****
/* make sure it is a directory */
if (lstat(compath(dir), &statstruct) == 0 &&
! (statstruct.st_mode & S_IFDIR)) {
/* note: there already is a source directory list */
--- 160,164 ----
/* make sure it is a directory */
if (lstat(compath(dir), &statstruct) == 0 &&
! S_ISDIR(statstruct.st_mode)) {
/* note: there already is a source directory list */
***************
*** 228,232 ****
/* make sure it is a directory */
if (lstat(compath(path), &statstruct) == 0 &&
! (statstruct.st_mode & S_IFDIR)) {
if (incdirs == NULL) {
incdirs = mymalloc(mincdirs * sizeof(char *));
--- 228,232 ----
/* make sure it is a directory */
if (lstat(compath(path), &statstruct) == 0 &&
! S_ISDIR(statstruct.st_mode)) {
if (incdirs == NULL) {
incdirs = mymalloc(mincdirs * sizeof(char *));
***************
*** 495,499 ****
file = entry->d_name;
if (recurse_dir
! && (buf.st_mode & S_IFDIR) ) {
scan_dir(path, recurse_dir);
}
--- 495,499 ----
file = entry->d_name;
if (recurse_dir
! && S_ISDIR(buf.st_mode) ) {
scan_dir(path, recurse_dir);
}
***************
*** 559,563 ****
suffixes so make sure it is a file */
if (lstat(file, &statstruct) == 0 &&
! (statstruct.st_mode & S_IFREG)) {
return(YES);
}
--- 559,563 ----
suffixes so make sure it is a file */
if (lstat(file, &statstruct) == 0 &&
! S_ISREG(statstruct.st_mode)) {
return(YES);
}
***************
*** 571,575 ****
/* make sure it is a file */
if (lstat(file, &statstruct) == 0 &&
! (statstruct.st_mode & S_IFREG)) {
return(YES);
}
--- 571,575 ----
/* make sure it is a file */
if (lstat(file, &statstruct) == 0 &&
! S_ISREG(statstruct.st_mode)) {
return(YES);
}
|