1e837f5f6e
harder to avoid stack overflows, bump revision for that.
32 lines
1.1 KiB
Text
32 lines
1.1 KiB
Text
$NetBSD: patch-ac,v 1.1 2006/06/26 16:11:43 joerg Exp $
|
|
|
|
--- misc.c.orig 2006-06-26 15:29:28.000000000 +0000
|
|
+++ misc.c
|
|
@@ -181,9 +181,15 @@ read_dir(dir)
|
|
last_link = &(item->next);
|
|
count++;
|
|
|
|
+#ifdef NAME_MAX
|
|
+ if( subdir )
|
|
+ strncpy(item->fname, dir, NAME_MAX);
|
|
+ strncat(item->fname, dp->d_name, NAME_MAX);
|
|
+#else
|
|
if( subdir )
|
|
strncpy(item->fname, dir, MAXNAMLEN);
|
|
strncat(item->fname, dp->d_name, MAXNAMLEN);
|
|
+#endif
|
|
|
|
stat(item->fname, &info); /* discover information about this file */
|
|
|
|
@@ -195,7 +201,11 @@ read_dir(dir)
|
|
if( S_ISDIR(info.st_mode) ) { /* IF directory -- check if sym-link */
|
|
lstat(item->fname, &info);
|
|
item->type = ( S_ISLNK(info.st_mode) ? DirLink : Dir );
|
|
+#ifdef NAME_MAX
|
|
+ strncat(item->fname, "/", NAME_MAX); /* append `/' to dir name */
|
|
+#else
|
|
strncat(item->fname, "/", MAXNAMLEN); /* append `/' to dir name */
|
|
+#endif
|
|
if( app_data.recursive ) /* do recursion if needed */
|
|
if( ! read_dir( item->fname ) )
|
|
item->type = DirBad;
|