gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r7971 - libmicrohttpd/src/testcurl/https


From: gnunet
Subject: [GNUnet-SVN] r7971 - libmicrohttpd/src/testcurl/https
Date: Sun, 23 Nov 2008 09:21:16 -0700 (MST)

Author: holindho
Date: 2008-11-23 09:21:16 -0700 (Sun, 23 Nov 2008)
New Revision: 7971

Modified:
   libmicrohttpd/src/testcurl/https/bug-test.c
   libmicrohttpd/src/testcurl/https/mhds_multi_daemon_test.c
   libmicrohttpd/src/testcurl/https/tls_authentication_test.c
   libmicrohttpd/src/testcurl/https/tls_daemon_options_test.c
Log:
current_dir_name() is a GNU extension


Modified: libmicrohttpd/src/testcurl/https/bug-test.c
===================================================================
--- libmicrohttpd/src/testcurl/https/bug-test.c 2008-11-23 09:28:26 UTC (rev 
7970)
+++ libmicrohttpd/src/testcurl/https/bug-test.c 2008-11-23 16:21:16 UTC (rev 
7971)
@@ -27,6 +27,7 @@
 #include "platform.h"
 #include "microhttpd.h"
 
+#include <limits.h>
 #include <sys/stat.h>
 
 #include "gnutls.h"
@@ -131,6 +132,7 @@
   struct CBC cbc;
   CURLcode errornum;
   char *doc_path;
+  size_t doc_path_len;
   char url[255];
   struct stat statb;
 
@@ -142,7 +144,21 @@
   unsigned char *mem_test_file_local;
 
   /* setup test file path, url */
-  doc_path = get_current_dir_name ();
+  doc_path_len = PATH_MAX > 4096 ? 4096 : PATH_MAX;
+  if (NULL == (doc_path = malloc (doc_path_len)))
+    {
+      fclose (test_fd);
+      fprintf (stderr, MHD_E_MEM);
+      return -1;
+    }
+  if (getcwd (doc_path, doc_path_len) == NULL) 
+    {
+      fclose (test_fd);
+      free (doc_path);
+      fprintf (stderr, "Error: failed to get working directory. %s\n",
+               strerror (errno));
+      return -1;
+    }
 
   if (NULL == (mem_test_file_local = malloc (len)))
     {

Modified: libmicrohttpd/src/testcurl/https/mhds_multi_daemon_test.c
===================================================================
--- libmicrohttpd/src/testcurl/https/mhds_multi_daemon_test.c   2008-11-23 
09:28:26 UTC (rev 7970)
+++ libmicrohttpd/src/testcurl/https/mhds_multi_daemon_test.c   2008-11-23 
16:21:16 UTC (rev 7971)
@@ -27,12 +27,14 @@
 #include "platform.h"
 #include "microhttpd.h"
 #include <curl/curl.h>
+#include <limits.h>
 #include <sys/stat.h>
 
 #define DEBUG_CURL_VERBOSE 0
 
 #define PAGE_NOT_FOUND "<html><head><title>File not 
found</title></head><body>File not found</body></html>"
 
+#define MHD_E_MEM "Error: memory error\n"
 #define MHD_E_SERVER_INIT "Error: failed to start server\n"
 #define MHD_E_TEST_FILE_CREAT "Error: failed to setup test file\n"
 
@@ -126,6 +128,7 @@
   struct CBC cbc;
   CURLcode errornum;
   char *doc_path;
+  size_t doc_path_len;
   char url[255];
   size_t len;
   struct stat file_stat;
@@ -137,7 +140,21 @@
   unsigned char *mem_test_file_local;
 
   /* setup test file path, url */
-  doc_path = get_current_dir_name ();
+  doc_path_len = PATH_MAX > 4096 ? 4096 : PATH_MAX;
+  if (NULL == (doc_path = malloc (doc_path_len)))
+    {
+      fclose (test_fd);
+      fprintf (stderr, MHD_E_MEM);
+      return -1;
+    }
+  if (getcwd (doc_path, doc_path_len) == NULL) 
+    {
+      fclose (test_fd);
+      free (doc_path);
+      fprintf (stderr, "Error: failed to get working directory. %s\n",
+               strerror (errno));
+      return -1;
+    }
 
   mem_test_file_local = malloc (len);
   fseek (test_fd, 0, SEEK_SET);

Modified: libmicrohttpd/src/testcurl/https/tls_authentication_test.c
===================================================================
--- libmicrohttpd/src/testcurl/https/tls_authentication_test.c  2008-11-23 
09:28:26 UTC (rev 7970)
+++ libmicrohttpd/src/testcurl/https/tls_authentication_test.c  2008-11-23 
16:21:16 UTC (rev 7971)
@@ -27,6 +27,7 @@
 #include "platform.h"
 #include "microhttpd.h"
 #include <curl/curl.h>
+#include <limits.h>
 #include <sys/stat.h>
 
 #define DEBUG_CURL_VERBOSE 0
@@ -128,6 +129,7 @@
   struct CBC cbc;
   CURLcode errornum;
   char *doc_path;
+  size_t doc_path_len;
   char url[255];
   struct stat statb;
 
@@ -139,7 +141,21 @@
   unsigned char *mem_test_file_local;
 
   /* setup test file path, url */
-  doc_path = get_current_dir_name ();
+  doc_path_len = PATH_MAX > 4096 ? 4096 : PATH_MAX;
+  if (NULL == (doc_path = malloc (doc_path_len)))
+    {
+      fclose (test_fd);
+      fprintf (stderr, MHD_E_MEM);
+      return -1;
+    }
+  if (getcwd (doc_path, doc_path_len) == NULL) 
+    {
+      fclose (test_fd);
+      free (doc_path);
+      fprintf (stderr, "Error: failed to get working directory. %s\n",
+               strerror (errno));
+      return -1;
+    }
 
   if (NULL == (mem_test_file_local = malloc (len)))
     {

Modified: libmicrohttpd/src/testcurl/https/tls_daemon_options_test.c
===================================================================
--- libmicrohttpd/src/testcurl/https/tls_daemon_options_test.c  2008-11-23 
09:28:26 UTC (rev 7970)
+++ libmicrohttpd/src/testcurl/https/tls_daemon_options_test.c  2008-11-23 
16:21:16 UTC (rev 7971)
@@ -28,6 +28,7 @@
 #include "microhttpd.h"
 
 #include <sys/stat.h>
+#include <limits.h>
 #include "gnutls.h"
 #include <curl/curl.h>
 
@@ -144,6 +145,7 @@
   CURLcode errornum;
   struct CBC cbc;
   char *doc_path;
+  size_t doc_path_len;
   char url[255];
   struct stat statb;
 
@@ -155,7 +157,21 @@
   unsigned char *mem_test_file_local;
 
   /* setup test file path, url */
-  doc_path = get_current_dir_name ();
+  doc_path_len = PATH_MAX > 4096 ? 4096 : PATH_MAX;
+  if (NULL == (doc_path = malloc (doc_path_len)))
+    {
+      fclose (test_fd);
+      fprintf (stderr, MHD_E_MEM);
+      return -1;
+    }
+  if (getcwd (doc_path, doc_path_len) == NULL) 
+    {
+      fclose (test_fd);
+      free (doc_path);
+      fprintf (stderr, "Error: failed to get working directory. %s\n",
+               strerror (errno));
+      return -1;
+    }
 
   if (NULL == (mem_test_file_local = malloc (len)))
     {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]