Re: [PATCH v3 02/10] unix-sockets: use strbuf_getcwd()

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

 



On Mon, Jul 28, 2014 at 08:25:40PM +0200, René Scharfe wrote:

> Instead of using a PATH_MAX-sized buffer, which can be too small on some
> file systems, use strbuf_getcwd(), which handles any path getcwd()
> returns.  Also preserve the errno set by strbuf_getcwd() instead of
> setting it to ENAMETOOLONG; that way a more appropriate error message
> can be shown based on the actual reason for failing.
> 
> Signed-off-by: Rene Scharfe <l.s.r@xxxxxx>
> ---
>  unix-socket.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/unix-socket.c b/unix-socket.c
> index 91bd6b8..19ed48b 100644
> --- a/unix-socket.c
> +++ b/unix-socket.c
> @@ -18,12 +18,12 @@ static int chdir_len(const char *orig, int len)
>  }
>  
>  struct unix_sockaddr_context {
> -	char orig_dir[PATH_MAX];
> +	char *orig_dir;
>  };

I would have expected this to just convert to a strbuf. I guess, though
that you were making this...

>  
>  static void unix_sockaddr_cleanup(struct unix_sockaddr_context *ctx)
>  {
> -	if (!ctx->orig_dir[0])
> +	if (!ctx->orig_dir)
>  		return;

...a little nicer by using the pointer to check for validity. Looks good
to me.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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]