[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r2003 - gnunet-gtk/src/plugins/fs
From: |
durner |
Subject: |
[GNUnet-SVN] r2003 - gnunet-gtk/src/plugins/fs |
Date: |
Sun, 28 Aug 2005 06:18:51 -0700 (PDT) |
Author: durner
Date: 2005-08-28 06:18:47 -0700 (Sun, 28 Aug 2005)
New Revision: 2003
Modified:
gnunet-gtk/src/plugins/fs/download.c
Log:
improve workaround for MAX_PATH issue
Modified: gnunet-gtk/src/plugins/fs/download.c
===================================================================
--- gnunet-gtk/src/plugins/fs/download.c 2005-08-28 10:24:18 UTC (rev
2002)
+++ gnunet-gtk/src/plugins/fs/download.c 2005-08-28 13:18:47 UTC (rev
2003)
@@ -124,6 +124,9 @@
GtkTreePath *dirTreePath;
char *dirPath;
unsigned int dirPathLen;
+#ifdef WINDOWS
+ unsigned int downDirLen;
+#endif
uri = NULL;
meta = NULL;
@@ -192,6 +195,9 @@
"DOWNLOADDIR",
_("You must specify a directory in the configuration"
" in section `%s' under `%s'."));
+#ifdef WINDOWS
+ downDirLen = strlen(fn);
+#endif
mkdirp(fn);
pfx = MALLOC(strlen(fn) + 2 +
strlen(name));
@@ -208,23 +214,39 @@
DIR_SEPARATOR_STR);
strcat(pfx,
name);
-#ifndef WINDOWS
strcat(lnk,
&filename[strlen(ECRS_URI_PREFIX) +
strlen(ECRS_FILE_INFIX)]);
-#else
+#ifdef WINDOWS
{
- /* Do not exceed MAX_PATH under Windows */
+ /* Do not exceed MAX_PATH under Windows
+ The longest path we get is
+ $DOWNLOADDIR\hash.lnk
+ or
+ $INCOMINGDIR\hash.lnk
+
+ We truncate the hash here accordingly. */
+
+ int diff; /* How much is INCOMINGDIR larger than DOWNLOADDIR */
+ char *inc = getFileName("FS",
+ "INCOMINGDIR",
+ _("You must specify a directory in the configuration"
+ " in section `%s' under `%s'."));
+
+ diff = downDirLen - strlen(inc);
+ if (diff < 0)
+ diff = 0;
- int fnlen = MAX_PATH - strlen(lnk) - 4; /* 4 = ".lnk"*/
- if (fnlen < 4) {
+ FREE(inc);
+
+ char *end = lnk + MAX_PATH - 5 - diff; /* 4 = ".lnk" */
+
+ *end = 0;
+
+ if (strchr(end + 1, DIR_SEPARATOR)) {
BREAK();
return;
}
-
- strncat(lnk,
- &filename[strlen(ECRS_URI_PREFIX) +
- strlen(ECRS_FILE_INFIX)], fnlen);
}
#endif
if (0 != STAT(pfx,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r2003 - gnunet-gtk/src/plugins/fs,
durner <=