Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Aug 1997 22:22:04 -0700 (PDT)
From:      Doug White <dwhite@gdi.uoregon.edu>
To:        Zach Heilig <zach@gaffaneys.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: Is that floppy write-protected?
Message-ID:  <Pine.BSF.3.96.970830222053.664N-100000@localhost>
In-Reply-To: <19970828085510.60034@gaffaneys.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 28 Aug 1997, Zach Heilig wrote:

> Is it possible to determine if a floppy disk is write-protected from a script?
> If you happen to be staring at the console, it's pretty obvious for a person
> to determine what is happening, but I can't figure out how to tell from a 
> script.
> 
> If you mount a write-protected flopp, and remove a file on it, the script
> can't tell if the file was really removed or not (it sure looks like it was
> removed from the scripts point of view).

Check the return value from `rm'; if it's >0 then something bad happened.

> I know I could unmount the floppy, remount it, and test if the files are
> really gone, but then /var/log/messages becomes full of needless
> write-protected floppy errors.  This is what I ended up doing, but it
> would be nice if there were a better solution.

How about re-read the directory following the `rm'?  If rm trashed the
file then the dir re-read should show it's gone.

Doug White                              | University of Oregon  
Internet:  dwhite@resnet.uoregon.edu    | Residence Networking Assistant
http://gladstone.uoregon.edu/~dwhite    | Computer Science Major
Spam routed to /dev/null by Procmail    | Death to Cyberpromo




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.970830222053.664N-100000>