gnunet-svn
[Top][All Lists]
Advanced

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

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


From: durner
Subject: [GNUnet-SVN] r2258 - gnunet-gtk/src/plugins/fs
Date: Fri, 18 Nov 2005 14:11:07 -0800 (PST)

Author: durner
Date: 2005-11-18 14:11:01 -0800 (Fri, 18 Nov 2005)
New Revision: 2258

Modified:
   gnunet-gtk/src/plugins/fs/download.c
Log:
Check whether INCOMINGDIR and DOWNLOADDIR are the same (Mantis #973)

Modified: gnunet-gtk/src/plugins/fs/download.c
===================================================================
--- gnunet-gtk/src/plugins/fs/download.c        2005-11-17 18:10:39 UTC (rev 
2257)
+++ gnunet-gtk/src/plugins/fs/download.c        2005-11-18 22:11:01 UTC (rev 
2258)
@@ -115,6 +115,7 @@
   char * pfx;
   char * lnk;
   char * fn;
+  char * inc;
   DownloadList * list;
   GtkTreeIter iiter;
   GtkWidget * spin;
@@ -183,6 +184,27 @@
   if (name == NULL)
     name = filename;
 
+  fn = getFileName("FS",
+                   "DOWNLOADDIR",
+                   _("You must specify a directory in the configuration"
+                     " in section `%s' under `%s'."));
+  inc = getFileName("FS",
+                   "INCOMINGDIR",
+                   _("You must specify a directory in the configuration"
+                     " in section `%s' under `%s'."));
+                     
+  if (strcmp(fn, inc) == 0) {
+    LOG(LOG_ERROR, _("You must specify different directories in the "
+                      "configuration in section `%s' under `%s' and `%s'."),
+                      "FS", "DOWNLOADDIR", "INCOMINGDIR");
+                      
+    FREE(filename);
+    FREENONNULL(fn);
+    FREENONNULL(inc);
+                      
+    return;
+  }
+
   addLogEntry(_("Downloading `%s'"), name);
 
   list = MALLOC(sizeof(DownloadList));
@@ -194,10 +216,7 @@
     list->model = model;
   }
   list->uri = ECRS_dupUri(uri);
-  fn = getFileName("FS",
-                   "DOWNLOADDIR",
-                   _("You must specify a directory in the configuration"
-                     " in section `%s' under `%s'."));
+                     
 #ifdef WINDOWS
   downDirLen = strlen(fn);
 #endif
@@ -243,17 +262,11 @@
        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;
 
-    FREE(inc);
-
     char *end = lnk + MAX_PATH - 5 - diff; /* 4 = ".lnk" */
 
     *end = 0;
@@ -264,6 +277,9 @@
     }
   }
 #endif
+
+  FREENONNULL(inc);
+
   if (0 != STAT(pfx,
                 &sbuf)) {
     if (0 != SYMLINK(lnk, pfx))





reply via email to

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