[pve-devel] [PATCH ha-manager] is_node_shutdown: check for correct systemd targets

Dietmar Maurer dietmar at proxmox.com
Mon Dec 19 10:06:59 CET 2016


> -	$shutdown = 1 if ($line =~ m/shutdown\.target/);
> +	$shutdown = 1 if ($line =~ m/(poweroff|halt)\.target/);

I wonder if we can improve that regex, to prevent false positives
if somebody defined a target like 'my-useless-poweroff.target'?

For example:

  $shutdown = 1 if ($line =~ m/^(poweroff|halt)\.target$/);

would that work?




More information about the pve-devel mailing list