emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: doc-view cache file permissions


From: Stefan Monnier
Subject: Re: doc-view cache file permissions
Date: Tue, 30 Oct 2007 17:56:49 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

>> +    ;; Try and make sure doc-view-cache-directory exists and is safe.
>> +    (condition-case nil
>> +        (make-directory doc-view-cache-directory)
>> +      (file-already-exists
>> +       (cond
>> +        ((file-symlink-p doc-view-cache-directory)
>> +         (error "Danger: doc-view-cache-directory points to a symbolic 
>> link"))
>> +        ((not (file-directory-p doc-view-cache-directory))
>> +         (error "doc-view-cache-directory is not a directory"))
>> +        ((not (file-writable-p doc-view-cache-directory))
>> +         (error "Cannot write to doc-view-cache-directory"))
>> +        ((not (= (user-uid) (nth 2 (file-attributes 
>> doc-view-cache-directory))))
>> +         (error "Danger: doc-view-cache-directory does not belong to 
>> us")))))

> Is that worthy of being the basis of a more generally available
> `make-secure-directory' function?

Could be.  Although I might want to call it "make directory-secure"
since the point is to be able to use a "known" directory which may
already exist.  Note that the code I just installed is simpler (and
safer).  Also I'm not 100% that the code is actually safe.  I'm pretty
sure it's safer.

Otherwise, if you really want a brand new directory, you can use
make-temp-file.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]