Re: [PATCH/RFC/GSoC 1/3] path.c: implement xdg_runtime_dir()

2016-03-19 Thread 惠轶群
2016-03-17 1:06 GMT+08:00 Jeff King : > On Wed, Mar 16, 2016 at 06:07:43PM +0800, Hui Yiqun wrote: > >> + if (runtime_dir && *runtime_dir) >> + git_runtime_dir = mkpathdup("%s/git/", runtime_dir); >> + else >> + git_runtime_dir = mkpathdup("/tmp/git-%d", uid); > > He

Re: [PATCH/RFC/GSoC 1/3] path.c: implement xdg_runtime_dir()

2016-03-19 Thread Jeff King
On Wed, Mar 16, 2016 at 06:07:43PM +0800, Hui Yiqun wrote: > + if (runtime_dir && *runtime_dir) > + git_runtime_dir = mkpathdup("%s/git/", runtime_dir); > + else > + git_runtime_dir = mkpathdup("/tmp/git-%d", uid); Here we allocate the string, but later we may retu

[PATCH/RFC/GSoC 1/3] path.c: implement xdg_runtime_dir()

2016-03-16 Thread Hui Yiqun
this function does the following: 1. if $XDG_RUNTIME_DIR is non-empty, `$XDG_RUNTIME_DIR/git` is used in next step, otherwise `/tmp/git-$uid` is taken. 2. ensure that above directory does exist. what's more, it must has correct permission and ownership. 3. a newly allocated string consisting of th