[pve-devel] [PATCH common] handle % signs in $task->{status} before sprintf

Dietmar Maurer dietmar at proxmox.com
Thu Jan 7 16:44:19 CET 2016


> -	    if ($task->{status}) {
> -		$raw .= sprintf("$upid $saved %08X $task->{status}\n", $task->{endtime});
> +	    if (my $status = $task->{status}) {
> +		$status =~ s/%/%%/g;
> +		$raw .= sprintf("$upid $saved %08X $status\n", $task->{endtime});

that looks clumsy to me - what about:

my $timestr = sprintf("%08X", $task->{endtime});
$raw .= "$upid $saved $timestr $status\n";

or

$raw .= sprintf("%s %s %08X %s\n", $upid, $saved, $task->{endtime},
$task->{status});

??




More information about the pve-devel mailing list