Re: [PATCH RFC3.5 02/12] send-email: No longer repeatedly test if $smtp_server is a command

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

 



Michael Witten <mfwitten@xxxxxxxxx> writes:

> This is a minor change, but it's cleaner, and it sets up the
> $smtp_server initialization code for future improvements.
> ...
> -if (!defined $smtp_server) {
> +if (defined $smtp_server) {
> +
> +	$smtp_server_is_a_command = ($smtp_server =~ m{^/});
> +
> +} else { # use a default:
> +
>  	foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
>  		if (-x $_) {
>  			$smtp_server = $_;
> +			$smtp_server_is_a_command = 1;
>  			last;
>  		}
>  	}
> -	$smtp_server ||= 'localhost'; # could be 127.0.0.1, too... *shrug*
> +
> +	$smtp_server = 'localhost'; # 127.0.0.1 is not compatible with IPv6
> +		unless $smtp_server_is_a_command;

Nobody suggests to use 127.0.0.1 anymore with this change, so why not just
get rid of that comment?

Also the new statement looks wrong.

 (1) you have ';' after assignment before the statement modifier "unless";
     I do not think you meant it.  I generally *dis*like statement
     modifiers, but if you use it, at least please use it correctly.

 (2) earlier, when $smtp_server is defined (say, the name of your smtp
     host) but is not a command, we did not set smtp_server to
     'localhost', but kept the value given by the user.  Now you seem to
     kill the user's wish with this change.

I think a genuine improvement would be something like:

	if (!defined $smtp_server) {
        	$smtp_server = 'localhost';
	}

Of course if you are writing for a project that is "5.8.1 or later only",
you could say:

	$smtp_server //= 'localhost';

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