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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -