smbclient, find, and NetBSD (fwd)

David Lee T.D.Lee at durham.ac.uk
Thu Apr 5 14:20:52 GMT 2001


On Thu, 5 Apr 2001, Andrew Tridgell wrote:

> That one is my fault I'm afraid. Many years ago I was lazy in using
> find to generate the list of files - I should have used
> opendir()/readdir() etc (essentially implementing a little find
> function in Samba).
> 
> The correct fix is to remove the find call and instead write a fn that
> does directory traversal returning a list of names (perhaps as a
> linked list). That will make us portable. Using #ifdefs for different
> versions of find assumes that the system actually has something that
> is like find, which is not a valid assumption with some of the more
> obscure ports of Samba.

This sounds like the "scandir()" call.  I know nothing about the insides
of smbclient, but it might be worth trying this proposed rewrite in terms
of "scandir()", which also makes the "autoconf" reasonably easy.

I believe "scandir()" is reasonably widely available.  And for those
systems that don't have it, a replacement can be substituted, as directed
by autoconf.

(The only reason that "scandir()" came to my attention at all is because
another couple of products (linux-pam and linux-ha) I looked at recently
simply assumed it was present: but it isn't on Solaris (my OS).  Actually
it is, but hidden away under a seemingly deprecated "for BSD compatibility
only"  section. So I hacked together a replacement.) 

> Anyone want to take this on? 

No, because I don't know about it.  But if you go the "scandir()" route
then you can (test and) have my "scandir()"-if-absent code.

-- 

:  David Lee                                I.T. Service          :
:  Systems Programmer                       Computer Centre       :
:                                           University of Durham  :
:  http://www.dur.ac.uk/t.d.lee/            South Road            :
:                                           Durham                :
:  Phone: +44 191 374 2882                  U.K.                  :





More information about the samba-technical mailing list