permission of imagedir/.thumbnails
Shinichi Maruyama <marya-nJf9iER0oJ/qq2nvvmkE/[email protected]> Tue, 31 May 2005 13:56:57 +0900 (JST)
| Newsgroups | gmane.comp.gnome.apps.gqview.devel |
|---|---|
| Message-ID | <[email protected]> |
I use gqview 2.1.0.
When mkdir "imagedir/.thumbnails", gqview will use permission
0775 from the result of cache_get_location(). But it's not used as it
is because the mode of mkdir is restricted by the umask, which is
normally 022.
However, I don't think it's good to set it always 0775.
Because "imagedir" may be under the private home directory, and I
don't want the directory to be group writable.
Why don't you use the same permission of base "imagedir". And
set the same uid/gid if possible.
Here is a sample coding.
src = path_from_utf8(src_utf8); /* base imagedir */
dst = path_from_utf8(dst_utf8); /* imagedir/.thumbnails */
if (stat(src,&st) < 0) {
if (debug) perror(src);
return FALSE;
}
(void)chown(dst,st.st_uid,-1); /* only root can change uid */
if (chown(dst,-1,st.st_gid) < 0) {
st.st_mode &= ~(S_IWGRP);
}
if (chmod(dst,(st.st_mode & ACCESSPERMS)) < 0) {
if (debug) perror(dst);
return FALSE;
}
--
Shinichi Maruyama (marya-nJf9iER0oJ/qq2nvvmkE/[email protected])
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005