Re: [GSoC][PATCH v4 3/4] credential-cache: use XDG_CACHE_HOME for socket

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

 



On Thu, Mar 16, 2017 at 09:20:29AM -0700, Junio C Hamano wrote:

> static char *get_socket_path(void)
> {
> 	struct stat st;
> 	char *path;
> 
> 	path = expand_user_path("~/.git-credential-cache");
> 	if (path && !stat(path, &st) && S_ISDIR(st.st_mode))) {
> 		free(path);
> 		path = expand_user_path("~/.git-credential-cache/socket");
> 	} else {
> 		path = xdg_cache_home("credential/socket");
> 	}                
> 	return path;
> }
> 
> The duplication of "~/.git-credential-cache" bothers me somewhat and
> perhaps people can suggest better ways to get rid of the dup.

Maybe:

  path = expand_user_path("~/.git-credential-cache");
  if (path && !stat(path, &st) && S_ISDIR(st.st_mode))) {
	char *new_path = xstrfmt("%s/socket", path);
	free(path);
	path = new_path;
  } else ...

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]