libsmbclient C API problem

Nilesh Simaria nilesh at deeproot.co.in
Fri Dec 6 17:14:13 GMT 2002


Hello,

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://192.168.1.102/Share1/a.txt");
                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));
                                exit(-1);
                        }
                }
        }
}

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

Nilesh.





More information about the smb-clients mailing list