gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1966 - gnunet-gtk/src/plugins/fs


From: durner
Subject: [GNUnet-SVN] r1966 - gnunet-gtk/src/plugins/fs
Date: Sat, 27 Aug 2005 11:28:58 -0700 (PDT)

Author: durner
Date: 2005-08-27 11:28:55 -0700 (Sat, 27 Aug 2005)
New Revision: 1966

Modified:
   gnunet-gtk/src/plugins/fs/download.c
Log:
- don't exceed MAX_PATH under Windows

Modified: gnunet-gtk/src/plugins/fs/download.c
===================================================================
--- gnunet-gtk/src/plugins/fs/download.c        2005-08-27 18:25:39 UTC (rev 
1965)
+++ gnunet-gtk/src/plugins/fs/download.c        2005-08-27 18:28:55 UTC (rev 
1966)
@@ -199,9 +199,25 @@
            DIR_SEPARATOR_STR);
   strcat(pfx, 
          name);
+#ifndef WINDOWS
   strcat(lnk, 
          &filename[strlen(ECRS_URI_PREFIX) +
                    strlen(ECRS_FILE_INFIX)]);
+#else
+  {
+    /* Do not exceed MAX_PATH under Windows */
+    
+    int fnlen = MAX_PATH - strlen(lnk) - 4; /* 4 = ".lnk"*/
+    if (fnlen < 4) {
+      BREAK();
+      return;
+    }
+    
+    strncat(lnk,
+           &filename[strlen(ECRS_URI_PREFIX) +
+                     strlen(ECRS_FILE_INFIX)], fnlen);
+  }
+#endif
   if (0 != STAT(pfx,
                 &sbuf)) {
     if (0 != SYMLINK(lnk, pfx))
@@ -371,14 +387,13 @@
         
         ren = ECRS_suggestFilename(ln);
         newFn = strrchr(ren ? ren : ln, DIR_SEPARATOR) + 1;
-        dstPath = getConfigurationString("FS", "INCOMINGDIR");
-        if (!dstPath) {
-          LOG(LOG_ERROR,
-             _("You must specify a directory in the configuration"
-              " in section `%s' under `%s'.\n"), "FS", "INCOMINGDIR");
-            
+
+        dstPath = getFileName("FS",
+                         "INCOMINGDIR",
+                         _("You must specify a directory in the configuration"
+                           " in section `%s' under `%s'."));
+        if (!dstPath)
           return;
-        }
         mkdirp(dstPath);
                   
         dstFile = MALLOC(strlen(dstPath) + strlen(newFn) + 2);





reply via email to

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