No point trying to read a directory

This commit is contained in:
Jamie Cameron
2019-01-14 23:23:13 -08:00
parent 216a906aea
commit c2c2d5b2c6

View File

@ -190,7 +190,11 @@ while(1) {
elsif ($arg->{'action'} eq 'tcpread') {
# Transfer data from a file over TCP connection
print STDERR "fastrpc: tcpread $arg->{'file'}\n" if ($gconfig{'rpcdebug'});
if (!open(FILE, $arg->{'file'})) {
if (-d $arg->{'file'}) {
$rawrv = &serialise_variable(
{ 'status' => 1, 'rv' => [ undef, "$arg->{'file'} is a directory" ] } );
}
elsif (!open(FILE, $arg->{'file'})) {
$rawrv = &serialise_variable(
{ 'status' => 1, 'rv' => [ undef, "Failed to open $arg->{'file'} : $!" ] } );
}