[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proposal for file protection extension
> >Who thinks file protection is OS-specific? Every OS under the
> >sun has such protection (or will have it soon).
>
> MS Windows does not support protections. If these were to be added to
> files.c, it would be necessary to add a test (during configuration) for
> whether sys/stat is supported, and (if so) whether the mode field is
> st_mode or st_basemode. There would also need to be a way within the Files
I've since changed that field to "st_mode" so this should be more portable.
All bets are off with MS Windows: it's not really an OS anyway, is it? ;-)
NT should support at least the user-level privileges.
> modules of testing whether a given file supports permissions or not,
> otherwise you can't tell whether you have the expected functionality. To be
> strict about it, this should probably be done on a "per-bit" basis, since
> some systems will support some permission bits and not others. This could
> be done by simply returning a SET of supported bits.
>
> The system would need to generate a run-time exception if someone attempts
> to set or get permissions when they are not supported by the file (ie. the
> file system on which the file is located) or the environment (ie. the C
> compiler libraries). Note that this can happen even under Unix since it is
> possible that the the program does not have sufficient priveledges to set
> the permissions, or that the file is on a file system for which permissions
> cannot be set (eg. a mounted DOS partition, CDROM file-system, etc).
I personally would prefer an error status or even no error at all in such
cases. After all, if the OS doesn't support something, the SW should fail
gracefully and not abort execution and dump errors over the user's terminal.
Michael G.