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

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


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 //   /mnt  -o

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

system("mount.cifs //   /mnt  -o

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",
          "//",  "/mnt",  "-o
user=name,pass=paswd,domain=domain.some,nounix", (char *) NULL) < 0)

I get the error:
mount: mounting // 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 ?


More information about the samba mailing list