diff options
author | Jim Blandy <jimb@redhat.com> | 1993-03-11 07:11:34 +0000 |
---|---|---|
committer | Jim Blandy <jimb@redhat.com> | 1993-03-11 07:11:34 +0000 |
commit | d6717cdb6db06dea89feaa5cd92e2de2fda1ed0f (patch) | |
tree | 78c20e94b170b5cc4b46a37df00f53222356d531 /src/dired.c | |
parent | 5447018c7bf83e6cce32958738e98c90fd2d28df (diff) | |
download | emacs-d6717cdb6db06dea89feaa5cd92e2de2fda1ed0f.tar.gz |
* 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/dired.c')
-rw-r--r-- | src/dired.c | 14 |
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. */ #include <rmsdef.h> #endif +/* The d_nameln member of a struct dirent includes the '\0' character + on some systems, but not on others. What's worse, you can't tell + at compile-time which one it will be, since it really depends on + the sort of system providing the filesystem you're reading from, + not the system you are running on. Paul Eggert + <eggert@bi.twinsun.com> says this occurs when Emacs is running on a + SunOS 4.1.2 host, reading a directory that is remote-mounted from a + Solaris 2.1 host and is in a native Solaris 2.1 filesystem. + + Since applying strlen to the name always works, we'll just do that. */ +#define NAMLEN(p) strlen (p->d_name) + #ifdef SYSV_SYSTEM_DIR #include <dirent.h> #define DIRENTRY struct dirent -#define NAMLEN(p) strlen (p->d_name) #else @@ -45,7 +56,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #endif /* not NONSYSTEM_DIR_LIBRARY */ #define DIRENTRY struct direct -#define NAMLEN(p) p->d_namlen extern DIR *opendir (); extern struct direct *readdir (); |