]> git.sesse.net Git - vlc/blobdiff - modules/misc/gnutls.c
Qt4: compressor and Spatializer widget margin shouldn't be 0
[vlc] / modules / misc / gnutls.c
index a58583b7541d531515a5f9a4915c5f417193c02c..5c527d2b1213045745417c5f204533ba898f747e 100644 (file)
@@ -36,9 +36,6 @@
 
 #include <sys/types.h>
 #include <errno.h>
-#ifdef HAVE_DIRENT_H
-# include <dirent.h>
-#endif
 #ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
@@ -52,6 +49,7 @@
 
 #include <vlc_tls.h>
 #include <vlc_charset.h>
+#include <vlc_fs.h>
 #include <vlc_block.h>
 
 #include <gcrypt.h>
@@ -164,11 +162,12 @@ static int gnutls_Error (vlc_object_t *obj, int val)
     switch (val)
     {
         case GNUTLS_E_AGAIN:
-#ifndef WIN32
+#ifdef WIN32
+            WSASetLastError (WSAEWOULDBLOCK);
+#else
             errno = EAGAIN;
-            break;
 #endif
-            /* WinSock does not return EAGAIN, return EINTR instead */
+            break;
 
         case GNUTLS_E_INTERRUPTED:
 #ifdef WIN32
@@ -237,7 +236,7 @@ gnutls_Recv( void *p_session, void *buf, int i_length )
 /**
  * Starts or continues the TLS handshake.
  *
- * @return -1 on fatal error, 0 on succesful handshake completion,
+ * @return -1 on fatal error, 0 on successful handshake completion,
  * 1 if more would-be blocking recv is needed,
  * 2 if more would-be blocking send is required.
  */
@@ -521,7 +520,7 @@ gnutls_Addx509Directory( vlc_object_t *p_this,
     if( *psz_dirname == '\0' )
         psz_dirname = ".";
 
-    dir = utf8_opendir( psz_dirname );
+    dir = vlc_opendir( psz_dirname );
     if( dir == NULL )
     {
         if (errno != ENOENT)
@@ -532,7 +531,7 @@ gnutls_Addx509Directory( vlc_object_t *p_this,
 
         msg_Dbg (p_this, "creating empty certificate directory: %s",
                  psz_dirname);
-        utf8_mkdir (psz_dirname, b_priv ? 0700 : 0755);
+        vlc_mkdir (psz_dirname, b_priv ? 0700 : 0755);
         return VLC_SUCCESS;
     }
 #ifdef S_ISLNK
@@ -547,7 +546,7 @@ gnutls_Addx509Directory( vlc_object_t *p_this,
          * that the inode is still the same, to avoid TOCTOU race condition.
          */
         if( ( fd == -1)
-         || fstat( fd, &st1 ) || utf8_lstat( psz_dirname, &st2 )
+         || fstat( fd, &st1 ) || vlc_lstat( psz_dirname, &st2 )
          || S_ISLNK( st2.st_mode ) || ( st1.st_ino != st2.st_ino ) )
         {
             closedir( dir );
@@ -558,7 +557,7 @@ gnutls_Addx509Directory( vlc_object_t *p_this,
 
     for (;;)
     {
-        char *ent = utf8_readdir (dir);
+        char *ent = vlc_readdir (dir);
         if (ent == NULL)
             break;
 
@@ -587,7 +586,7 @@ gnutls_Addx509File( vlc_object_t *p_this,
 {
     struct stat st;
 
-    int fd = utf8_open (psz_path, O_RDONLY);
+    int fd = vlc_open (psz_path, O_RDONLY);
     if (fd == -1)
         goto error;
 
@@ -680,7 +679,7 @@ static int OpenClient (vlc_object_t *obj)
     {
         char path[strlen (userdir) + sizeof ("/ssl/private")];
         sprintf (path, "%s/ssl", userdir);
-        utf8_mkdir (path, 0755);
+        vlc_mkdir (path, 0755);
 
         sprintf (path, "%s/ssl/certs", userdir);
         gnutls_Addx509Directory (VLC_OBJECT (p_session),