svn commit: samba r19017 - in
branches/SAMBA_4_0/source/lib/replace: .
vlendec at samba.org
vlendec at samba.org
Sun Oct 1 20:45:47 GMT 2006
Author: vlendec
Date: 2006-10-01 20:45:46 +0000 (Sun, 01 Oct 2006)
New Revision: 19017
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19017
Log:
Merge from Samba3:
Attempt to fix the BSD RAW-CHKPATH failures: In Samba3 we rely on opendir
returning ENOTDIR when the file opened is not a directory. Can we merge this
back into Samba4?
This includes the tabs->spaces fix requested by Stefan.
Volker
Modified:
branches/SAMBA_4_0/source/lib/replace/repdir_getdents.c
branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/repdir_getdents.c
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/repdir_getdents.c 2006-10-01 20:43:16 UTC (rev 19016)
+++ branches/SAMBA_4_0/source/lib/replace/repdir_getdents.c 2006-10-01 20:45:46 UTC (rev 19017)
@@ -68,6 +68,7 @@
DIR *opendir(const char *dname)
{
struct dir_buf *d;
+ struct stat sb;
d = malloc(sizeof(*d));
if (d == NULL) {
errno = ENOMEM;
@@ -78,6 +79,17 @@
free(d);
return NULL;
}
+ if (fstat(d->fd, &sb) < 0) {
+ close(d->fd);
+ free(d);
+ return NULL;
+ }
+ if (!S_ISDIR(sb.st_mode)) {
+ close(d->fd);
+ free(d);
+ errno = ENOTDIR;
+ return NULL;
+ }
d->ofs = 0;
d->seekpos = 0;
d->nbytes = 0;
Modified: branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c 2006-10-01 20:43:16 UTC (rev 19016)
+++ branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c 2006-10-01 20:45:46 UTC (rev 19017)
@@ -70,6 +70,7 @@
DIR *opendir(const char *dname)
{
struct dir_buf *d;
+ struct stat sb;
d = malloc(sizeof(*d));
if (d == NULL) {
errno = ENOMEM;
@@ -80,6 +81,17 @@
free(d);
return NULL;
}
+ if (fstat(d->fd, &sb) < 0) {
+ close(d->fd);
+ free(d);
+ return NULL;
+ }
+ if (!S_ISDIR(sb.st_mode)) {
+ close(d->fd);
+ free(d);
+ errno = ENOTDIR;
+ return NULL;
+ }
d->ofs = 0;
d->seekpos = 0;
d->nbytes = 0;
More information about the samba-cvs
mailing list