Mercurial > emacs
comparison src/sysdep.c @ 3760:e0be9df19ee1
* sysdep.c (closedir): Don't free directory buffer if it looks
like it and the DIR were malloced together.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Wed, 16 Jun 1993 20:31:01 +0000 |
parents | 036367460955 |
children | 68807e370e9d |
comparison
equal
deleted
inserted
replaced
3759:036367460955 | 3760:e0be9df19ee1 |
---|---|
2925 int | 2925 int |
2926 closedir (dirp) | 2926 closedir (dirp) |
2927 register DIR *dirp; /* stream from opendir */ | 2927 register DIR *dirp; /* stream from opendir */ |
2928 { | 2928 { |
2929 sys_close (dirp->dd_fd); | 2929 sys_close (dirp->dd_fd); |
2930 xfree ((char *) dirp->dd_buf); /* directory block defined in <dirent.h> */ | 2930 |
2931 /* Some systems allocate the buffer and the DIR all in one block. | |
2932 Why in the world are we freeing this ourselves anyway? */ | |
2933 if (dirp->dd_buf != (char *)(dirp + 1)) | |
2934 xfree ((char *) dirp->dd_buf); /* directory block defined in <dirent.h> */ | |
2931 xfree ((char *) dirp); | 2935 xfree ((char *) dirp); |
2932 } | 2936 } |
2933 #endif /* not AIX */ | 2937 #endif /* not AIX */ |
2934 #endif /* SYSV_SYSTEM_DIR */ | 2938 #endif /* SYSV_SYSTEM_DIR */ |
2935 | 2939 |