[Samba] CIFS/SMB mount not working with execl()

Ashoka K ashok.vinu at gmail.com
Thu May 21 07:57:32 MDT 2015


Hi,

I am using smb client on my application and mount SMB share using
system() call it works. Also applying the same command on shell it
works too.

On SHELL it works:
# mount.cifs //10.99.92.17/samba   /mnt  -o
user=name,pass=paswd,domain=domain.some,nounix

In application with system("...") call it works:

system("mount.cifs //10.99.92.17/samba   /mnt  -o
user=name,pass=paswd,domain=domain.some,nounix");

But if i replace the system("...") with the execl() call i get the below errors.

if (execl("/usr/local/bin/mount.cifs", "/usr/local/bin/mount.cifs",
          "//10.99.92.17/samba",  "/mnt",  "-o
user=name,pass=paswd,domain=domain.some,nounix", (char *) NULL) < 0)
{
   ...
}

I get the error:
mount: mounting //10.99.92.17/samba on  /mnt failed: Invalid argument

I tried to rearrange the the arguments by splitting "-o" and
"user=...." but still i get same error.

What would be the cause here?

What other alternatives I can use in application to avoid use of
system("..")  call to mount CIFS ?

Regards,
Ashoka


More information about the samba mailing list