[Merge] lp:~xnox/upstart/user-log-dir into lp:upstart
Dmitrijs Ledkovs
launchpad at surgut.co.uk
Tue Jan 22 12:07:25 UTC 2013
On 22 January 2013 10:28, James Hunt <james.hunt at canonical.com> wrote:
>
> * init/xdg.c:
> - get_home_subdir(): Return NULL immediately if nih_sprintf() fails.
> - get_user_log_dir(): Return NULL immediately if nih_sprintf() fails.
Done.
> - create_dir():
> - for consistency, this should probably call
> init/system.c:int system_mkdir(const char *path, mode_t mode) passing
> @dir and 0700.
> - should assert @dir: I don't understand why it currently handles
> a NULL directory explicitly?
Well, it did so because I didn't return Null straight away when
nih_sprintfs failed in get_home_subdir() and get_user_log_dir().
> - @dir param should be const.
> - Remove comment: the directory permissions must be 0700 according
> to the spec, which is an absolute value. Since we already reset
> umask(), the code will work as expected.
Awesome. Didn't notice this.
> - This (and/or system_mkdir()) should be documented explicitly as
> only creating the "leaf" directory (ie no recursive creation).
Well... after changing get_home_subdir() & get_user_log_dir(), the
"system_mkdir()" is a wrapper with nih_assert around path argument....
I think I went overboard with this wrapper =) instead I just use mkdir
directly. I guess we could add further nih_system_error / warning
saying that we failed to create XDG paths, but imho that's just noise.
--
https://code.launchpad.net/~xnox/upstart/user-log-dir/+merge/143091
Your team Upstart Reviewers is subscribed to branch lp:upstart.
More information about the upstart-devel
mailing list