summaryrefslogtreecommitdiff
path: root/graphics/xbmbrowser/patches/patch-ac
blob: f4114c8fda41000b55876a07910603031e179539 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$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;