summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c80f8bd)
raw | patch | inline | side by side (parent: c80f8bd)
author | Matthias Bethke <matthias.bethke@financial.com> | |
Tue, 21 Jul 2015 08:02:16 +0000 (15:02 +0700) | ||
committer | Matthias Bethke <matthias.bethke@financial.com> | |
Tue, 21 Jul 2015 08:02:16 +0000 (15:02 +0700) |
bindings/perl/lib/Collectd/Unixsock.pm | patch | blob | history |
index 5c6a5f9d24c74179b8c2e3a878619198398bdc73..69c755b6a92996cd192b9845ea87c866dd51b741 100644 (file)
sub _escape_argument
{
- local $_ = shift;
+ my $arg = shift;
- return $_ if /^\w+$/;
+ return $arg if $arg =~ /^\w+$/;
- s#\\#\\\\#g;
- s#"#\\"#g;
- return "\"$_\"";
+ $arg =~ s#\\#\\\\#g;
+ $arg =~ s#"#\\"#g;
+ return "\"$arg\"";
}
# Send a command on a socket, including any required argument escaping.