kumquat-buildroot/package/minicom/0002-change-maxnamlen-to-posixs-name-max.patch

52 lines
1.8 KiB
Diff
Raw Normal View History

# HG changeset patch
# User Adam Lackorzynski <adam@os.inf.tu-dresden.de>
# Date 1432407475 -7200
# Sat May 23 20:57:55 2015 +0200
# Node ID 93e5dd955c8bd944fd64bb04fd117c963c3758bc
# Parent 8bf81e6a8e60e37c2dec9577a1be6357b8d56165
Change MAXNAMLEN to POSIX's NAME_MAX
By Felix Janda <felix.janda@posteo.de>:
MAXNAMLEN is usually defined in <sys/param.h> but it is
better to use the equivalent POSIX NAME_MAX.
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
[Taken from upstream Mercurial commit 93e5dd955c8b]
diff -r 8bf81e6a8e60 -r 93e5dd955c8b src/getsdir.c
--- a/src/getsdir.c Sat May 23 20:57:11 2015 +0200
+++ b/src/getsdir.c Sat May 23 20:57:55 2015 +0200
@@ -145,7 +145,7 @@
*
* The data will be in the form:
* typedef struct dirEntry {
- * char fname[MAXNAMLEN + 1];
+ * char fname[NAME_MAX + 1];
* time_t time;
* mode_t mode;
* } GETSDIR_ENTRY;
@@ -232,7 +232,7 @@
}
/* copy the filename */
- strncpy((*datptr)[cnt].fname, dp->d_name, MAXNAMLEN);
+ strncpy((*datptr)[cnt].fname, dp->d_name, NAME_MAX);
/* get information about the directory entry */
snprintf(fpath, sizeof(fpath), "%s/%s", dirpath, dp->d_name);
diff -r 8bf81e6a8e60 -r 93e5dd955c8b src/getsdir.h
--- a/src/getsdir.h Sat May 23 20:57:11 2015 +0200
+++ b/src/getsdir.h Sat May 23 20:57:55 2015 +0200
@@ -23,9 +23,10 @@
*/
#include <dirent.h>
+#include <limits.h>
typedef struct dirEntry { /* structure of data item */
- char fname[MAXNAMLEN + 1]; /* filename + terminating null */
+ char fname[NAME_MAX + 1]; /* filename + terminating null */
time_t time; /* last modification date */
mode_t mode; /* file mode (dir? etc.) */
ushort cflags; /* caller field for convenience */