Fix segv bug in checkhashes.
[doldaconnect.git] / daemon / client.c
index e6075dc..bf30821 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Dolda Connect - Modular multiuser Direct Connect-style client
- *  Copyright (C) 2004 Fredrik Tolf (fredrik@dolda2000.com)
+ *  Copyright (C) 2004 Fredrik Tolf <fredrik@dolda2000.com>
  *  
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -81,7 +81,9 @@ static struct configvar myvars[] =
     {CONF_VAR_INT, "hashwritedelay", {.num = 300}},
     /** The amount of time, in seconds, to wait before automatically
      * rescanning the shared directories for changes. Set to zero (the
-     * default) to disable automatic rescanning. */
+     * default) to disable automatic rescanning. (Broken shares are
+     * always rescanned upon detection, regardless of this
+     * setting.) */
     {CONF_VAR_INT, "rescandelay", {.num = 0}},
     {CONF_VAR_END}
 };
@@ -526,13 +528,14 @@ static int hashfile(char *path)
  */
 static void checkhashes(void)
 {
-    struct sharecache *node;
+    struct sharecache *node, *next;
     struct hashcache *hc;
     char *path;
     
     node = shareroot->child;
-    for(node = shareroot->child; node != NULL; node = nextscnode(node))
+    for(node = shareroot->child; node != NULL; node = next)
     {
+       next = nextscnode(node);
        if(node->f.b.type != FILE_REG)
            continue;
        if(!node->f.b.hastth)