aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1993-03-11 07:11:34 +0000
committerJim Blandy1993-03-11 07:11:34 +0000
commitd6717cdb6db06dea89feaa5cd92e2de2fda1ed0f (patch)
tree78c20e94b170b5cc4b46a37df00f53222356d531 /src
parent5447018c7bf83e6cce32958738e98c90fd2d28df (diff)
downloademacs-d6717cdb6db06dea89feaa5cd92e2de2fda1ed0f.tar.gz
emacs-d6717cdb6db06dea89feaa5cd92e2de2fda1ed0f.zip
* dired.c (NAMLEN): Never use d_nameln to get the length of the
directory entry's name; it is used inconsistently. Always call strlen instead.
Diffstat (limited to 'src')
-rw-r--r--src/dired.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/dired.c b/src/dired.c
index 5be150ef002..23bb41e7496 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -30,11 +30,22 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
30#include <rmsdef.h> 30#include <rmsdef.h>
31#endif 31#endif
32 32
33/* The d_nameln member of a struct dirent includes the '\0' character
34 on some systems, but not on others. What's worse, you can't tell
35 at compile-time which one it will be, since it really depends on
36 the sort of system providing the filesystem you're reading from,
37 not the system you are running on. Paul Eggert
38 <eggert@bi.twinsun.com> says this occurs when Emacs is running on a
39 SunOS 4.1.2 host, reading a directory that is remote-mounted from a
40 Solaris 2.1 host and is in a native Solaris 2.1 filesystem.
41
42 Since applying strlen to the name always works, we'll just do that. */
43#define NAMLEN(p) strlen (p->d_name)
44
33#ifdef SYSV_SYSTEM_DIR 45#ifdef SYSV_SYSTEM_DIR
34 46
35#include <dirent.h> 47#include <dirent.h>
36#define DIRENTRY struct dirent 48#define DIRENTRY struct dirent
37#define NAMLEN(p) strlen (p->d_name)
38 49
39#else 50#else
40 51
@@ -45,7 +56,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
45#endif /* not NONSYSTEM_DIR_LIBRARY */ 56#endif /* not NONSYSTEM_DIR_LIBRARY */
46 57
47#define DIRENTRY struct direct 58#define DIRENTRY struct direct
48#define NAMLEN(p) p->d_namlen
49 59
50extern DIR *opendir (); 60extern DIR *opendir ();
51extern struct direct *readdir (); 61extern struct direct *readdir ();