Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: To write to /dev/rdisk1 USB pen drive (using BAS)



--- At Tue, 11 Mar 2008 20:00:10 +0530, Nick Rogers wrote:

>Hi,
>I'm using "BetterAuthorizationSample" from apple, which installs a  
>privileged helper tool for performing privileged operations.
>While using this I can obtain a valid file descriptor for reading any  
>disk, I can not get a valid file descriptor for writing to disk (/dev/ 
>rdisk1, which is a pen drive).
>I'm using:
>fileDesc = open(path, O_RDWR);
>in the privileged part (helper tool) of my code.
>
>Any help would be greatly appreciated.

O_RDWR will work if the disk is unmounted. While the disk is mounted, of
course the OS has the rdisk open. In order to write to the disk you have
to use O_SHLOCK.

fileDesc = open(path, O_RDWR | O_SHLOCK );

 ...Duane

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden

References: 
 >To write to /dev/rdisk1 USB pen drive (using BAS) (From: Nick Rogers <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.