libsmbclient C API problem

Nilesh Simaria nilesh at
Fri Dec 6 17:14:13 GMT 2002


I am using libsmbclient API to do some file operations on samba server. I
am able to list files. I am also able to open/create file using
smbc_open(), but when I try to close it using smbc_close(fd), it says "Bad
file descriptor".

Here is my code :

int main()
        int err, fd;
        err = smbc_init(auth_fn, 10);
        if (err < 0)
                printf("\n\tsmbc_init error....");
        else {
                fd = smbc_open("smb://");
                if (fd < 0)
                        printf("\n\tcant creat/open file");
                else {
                        err = smbc_close(fd); // This gives error.
                        if (err < 0) {
                                printf("\n\tcant close file. %s", strerror(errno));

I've checked out permissions related stuff. Whats wrong here.


More information about the smb-clients mailing list