Re: [PATCH v2 2/3] Convert existing die(..., strerror(errno)) to die_errno()

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

 



On Samstag, 6. Juni 2009, Thomas Rast wrote:
> Change calls to die(..., strerror(errno)) to use the new die_errno().
>
> In the process, also make slight style adjustments: at least state
> _something_ about the function that failed (instead of just printing
> the pathname), and put paths in single quotes.

> @@ -428,8 +428,8 @@ static void merge_name(const char *remote, struct
> strbuf *msg)
>
>  		fp = fopen(git_path("FETCH_HEAD"), "r");
>  		if (!fp)
> -			die("could not open %s for reading: %s",
> -				git_path("FETCH_HEAD"), strerror(errno));
> +			die_errno("could not open %s for reading",
> +				  git_path("FETCH_HEAD"));

You said you added quotes, but you didn't do that here and in quite a few more 
other cases.

IMHO, the quotes are not an improvement anyway, but that's really only my 
personal taste.

> --- a/connect.c
> +++ b/connect.c
> @@ -256,7 +256,7 @@ static int git_tcp_connect_sock(char *host, int flags)
>  	freeaddrinfo(ai0);
>
>  	if (sockfd < 0)
> -		die("unable to connect a socket (%s)", strerror(saved_errno));
> +		die_errno("unable to connect a socket");

You cannot convert this: We want strerror(saved_errno), but die_errno would 
print strerror(errno).

> @@ -345,7 +345,7 @@ static int git_tcp_connect_sock(char *host, int flags)
>  	}
>
>  	if (sockfd < 0)
> -		die("unable to connect a socket (%s)", strerror(saved_errno));
> +		die_errno("unable to connect a socket");

Same here.

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