• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/minicom/0002-change-maxnamlen-to-posixs-name-max.patch
Bernd KuhlsBernd Kuhls committed e01ec28d27523 Jan 2016
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
1
# HG changeset patch
2
# User Adam Lackorzynski <adam@os.inf.tu-dresden.de>
3
# Date 1432407475 -7200
4
#      Sat May 23 20:57:55 2015 +0200
5
# Node ID 93e5dd955c8bd944fd64bb04fd117c963c3758bc
6
# Parent  8bf81e6a8e60e37c2dec9577a1be6357b8d56165
7
Change MAXNAMLEN to POSIX's NAME_MAX
8
​
9
By Felix Janda <felix.janda@posteo.de>:
10
MAXNAMLEN is usually defined in <sys/param.h> but it is
11
better to use the equivalent POSIX NAME_MAX.
12
​
13
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
14
[Taken from upstream Mercurial commit 93e5dd955c8b]
15
​
16
diff -r 8bf81e6a8e60 -r 93e5dd955c8b src/getsdir.c
17
--- a/src/getsdir.c Sat May 23 20:57:11 2015 +0200
18
+++ b/src/getsdir.c Sat May 23 20:57:55 2015 +0200
19
@@ -145,7 +145,7 @@
20
  *
21
  *             The data will be in the form:
22
  *             typedef struct dirEntry {
23
- *                 char fname[MAXNAMLEN + 1];
24
+ *                 char fname[NAME_MAX + 1];
25
  *                 time_t time;
26
  *                 mode_t mode;
27
  *             } GETSDIR_ENTRY;
28
@@ -232,7 +232,7 @@
29
             }
30
 
31
           /* copy the filename */
32
-          strncpy((*datptr)[cnt].fname, dp->d_name, MAXNAMLEN);
33
+          strncpy((*datptr)[cnt].fname, dp->d_name, NAME_MAX);
34
 
35
           /* get information about the directory entry */
36
           snprintf(fpath, sizeof(fpath), "%s/%s", dirpath, dp->d_name);
37
diff -r 8bf81e6a8e60 -r 93e5dd955c8b src/getsdir.h
38
--- a/src/getsdir.h Sat May 23 20:57:11 2015 +0200
39
+++ b/src/getsdir.h Sat May 23 20:57:55 2015 +0200
40
@@ -23,9 +23,10 @@
41
  */
42
 
43
 #include <dirent.h>
44
+#include <limits.h>
45
 
46
 typedef struct dirEntry {      /* structure of data item */
47
-  char fname[MAXNAMLEN + 1];       /* filename + terminating null */
48
+  char fname[NAME_MAX + 1];        /* filename + terminating null */
49
   time_t time;             /* last modification date */
50
   mode_t mode;             /* file mode (dir? etc.) */
51
   ushort cflags;           /* caller field for convenience */
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.