smb2: change error handling
authorThomas Guillem <thomas@gllm.fr>
Tue, 12 Feb 2019 10:54:30 +0000 (11:54 +0100)
committerThomas Guillem <thomas@gllm.fr>
Tue, 12 Feb 2019 11:04:45 +0000 (12:04 +0100)
Some errors are not critical and should not be displayed.
Display error from dialog, only one time, if the Open() failed.

modules/access/smb2.c

index 48bcf01..8c91468 100644 (file)
@@ -105,17 +105,8 @@ smb2_check_status(stream_t *access, int status, const char *psz_func)
 
     if (status < 0)
     {
-        if (status != -EINTR)
-        {
-            const char *psz_error = smb2_get_error(sys->smb2);
-            msg_Err(access, "%s failed: %d, '%s'", psz_func, status, psz_error);
-            if (sys->error_status == 0)
-                vlc_dialog_display_error(access,
-                                         _("SMB2 operation failed"), "%s",
-                                         psz_error);
-        }
-        else
-            msg_Warn(access, "%s interrupted", psz_func);
+        const char *psz_error = smb2_get_error(sys->smb2);
+        msg_Warn(access, "%s failed: %d, '%s'", psz_func, status, psz_error);
         sys->error_status = status;
         return -1;
     }
@@ -659,7 +650,12 @@ Open(vlc_object_t *p_obj)
     vlc_credential_clean(&credential);
 
     if (ret != 0)
+    {
+        vlc_dialog_display_error(access,
+                                 _("SMB2 operation failed"), "%s",
+                                 smb2_get_error(sys->smb2));
         goto error;
+    }
 
     if (sys->smb2fh != NULL)
     {