linux - unmount USB drive in C++ -


i developing qt application linux (ubuntu) in use usb drive backup content. application should unmount target drive after copying stuff. have udev rule file mount usb @ specific location env{mount_options}="relatime,users,umask=0,uid=user,gid=user" user represents user name.

i tried using without luck.

const char* usb = "/mnt/mountpoint/usbdrive"; if (!umount(usb)) {   qdebug() << "device unmounted"; } else {   qdebug() << "can't unmount" << strerror(errno); //this prints operation not permitted } 

could please me here? using umount right?

thanks in advance.

appropriate privilege (linux: cap_sys_admin capability) required unmount file systems.

per umount code fine. need privilege umount devices.

the cap_sys_admin capability allows process perform various administrative tasks, namely: calling mount(), umount(). there 2 worth articles capabilities here:


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -