diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2014-01-06 14:45:25 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-01-06 09:34:21 -0800 |
commit | 0be0521b23f46dac586e1b464fafe8b97027b645 (patch) | |
tree | cc77526800270ba7e2d569ad94f2d31e16ca87c0 /cache.h | |
parent | 9e6f885d146c58b23b166a99b93f115735b7bf22 (diff) | |
download | git-0be0521b23f46dac586e1b464fafe8b97027b645.tar.gz |
safe_create_leading_directories(): introduce enum for return values
Instead of returning magic integer values (which a couple of callers
go to the trouble of distinguishing), return values from an enum. Add
a docstring.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -736,8 +736,21 @@ enum sharedrepo { }; int git_config_perm(const char *var, const char *value); int adjust_shared_perm(const char *path); -int safe_create_leading_directories(char *path); -int safe_create_leading_directories_const(const char *path); + +/* + * Create the directory containing the named path, using care to be + * somewhat safe against races. Return one of the scld_error values + * to indicate success/failure. + */ +enum scld_error { + SCLD_OK = 0, + SCLD_FAILED = -1, + SCLD_PERMS = -2, + SCLD_EXISTS = -3 +}; +enum scld_error safe_create_leading_directories(char *path); +enum scld_error safe_create_leading_directories_const(const char *path); + int mkdir_in_gitdir(const char *path); extern void home_config_paths(char **global, char **xdg, char *file); extern char *expand_user_path(const char *path); |