]> git.proxmox.com Git - pve-storage.git/commitdiff
scan_cifs: fix comment typo and indentation
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 30 Jun 2020 13:12:19 +0000 (15:12 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 1 Jul 2020 10:06:53 +0000 (12:06 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/Storage.pm

index 853287802b59055d54c8e42c12a4c53004af283b..fad97db7f5f7a4fd989c3987b3bd4ff56531fed7 100755 (executable)
@@ -1191,12 +1191,10 @@ sub scan_nfs {
 sub scan_cifs {
     my ($server_in, $user, $password, $domain) = @_;
 
-    my $server;
-    if (!($server = resolv_server ($server_in))) {
-       die "unable to resolve address for server '${server_in}'\n";
-    }
+    my $server = resolv_server($server_in);
+    die "unable to resolve address for server '${server_in}'\n" if !$server;
 
-    # we support only Windows grater than 2012 cifsscan so use smb3
+    # we only support Windows 2012 and newer, so just use smb3
     my $cmd = ['/usr/bin/smbclient', '-m', 'smb3', '-d', '0', '-L', $server];
     if (defined($user)) {
        die "password is required\n" if !defined($password);
@@ -1208,16 +1206,16 @@ sub scan_cifs {
 
     my $res = {};
     run_command($cmd,
-               outfunc => sub {
-                   my $line = shift;
-                   if ($line =~ m/(\S+)\s*Disk\s*(\S*)/) {
-                       $res->{$1} = $2;
-                   } elsif ($line =~ m/(NT_STATUS_(\S*))/) {
-                       $res->{$1} = '';
-                   }
-               },
-               errfunc => sub {},
-               noerr => 1
+       noerr => 1,
+       errfunc => sub { },
+       outfunc => sub {
+           my $line = shift;
+           if ($line =~ m/(\S+)\s*Disk\s*(\S*)/) {
+               $res->{$1} = $2;
+           } elsif ($line =~ m/(NT_STATUS_(\S*))/) {
+               $res->{$1} = '';
+           }
+       },
     );
 
     return $res;