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

Re: [leafnode-list] could not hand over lockfile to child



I wrote this recently:

>   2014          writeactive();
>   2015      }
>   2016
>   2017      switch (pid = fork()) {
>   2018      case -1:
>   2019          syslog(LOG_NOTICE, "fork: %m, running on parent
> schedule");
>   2020          fixxover();
>   2021          unlink(lockfile);
>   2022          freeactive(active);
>   2023          activesize = 0;
>   2024          active = NULL;
>   2025          break;
> 
> Please add the word "else" on the otherwise empty line 2016 (without quote
> marks), recompile and see if your problem is gone, then check if
> fetchnews runs properly with and without -P option and report back.

.. and I got the logic reversed. Instead of "else", please put
"if (!postonly)" (without the quotes) on line #2016.

You can also try this patch (it shall be available as
http://mandree.home.pages.de/leafnode/leafnode-1.9.25.patch02 but the
network connectivity to that site is not guaranteed this week-end, power
line works in progress):

To apply, cd to the directory where you unpacked leafnode 1.9.25,
save this mail to patch02, do "patch <patch02", then "make" and then, as
root, "make install".

diff -u -r1.64 -r1.66
--- fetchnews.c~	2002/08/14 15:50:41	1.64
+++ fetchnews.c	2002/08/31 09:26:35	1.66
@@ -2010,43 +2010,45 @@
     if (!postonly) {
 	/* only update active when we could read active from all servers
 	 */
-	if (rc == 0 && updateactive()) if (killactiveread()) rc = 1;
+	if (rc == 0 && updateactive())
+	    if (killactiveread())
+		rc = 1;
 	writeactive();
-    }
 
-    switch (pid = fork()) {
-    case -1:
-	syslog(LOG_NOTICE, "fork: %m, running on parent schedule");
-	fixxover();
-	unlink(lockfile);
-	freeactive(active);
-	activesize = 0;
-	active = NULL;
-	break;
+	switch (pid = fork()) {
+	    case -1:
+		syslog(LOG_NOTICE, "fork: %m, running on parent schedule");
+		fixxover();
+		unlink(lockfile);
+		freeactive(active);
+		activesize = 0;
+		active = NULL;
+		break;
 
-    case 0:
-	(void)setsid();
-	if (debugmode)
-	    syslog(LOG_DEBUG, "Process forked.");
-	if (!postonly) {
-	    fixxover();
-	}
-	unlink(lockfile);
-	freeactive(active);
-	activesize = 0;
-	active = NULL;
-	_exit(0);
-	break;
+	    case 0:
+		(void)setsid();
+		if (debugmode)
+		    syslog(LOG_DEBUG, "Process forked.");
+		if (!postonly) {
+		    fixxover();
+		}
+		unlink(lockfile);
+		freeactive(active);
+		activesize = 0;
+		active = NULL;
+		_exit(0);
+		break;
 
-    default:
-	if (handover_lock(pid)) {
-	    /* could not hand over lock file to child, so wait until it
-	       dies */
-	    syslog(LOG_NOTICE, "could not hand over lockfile to child: %m, "
-		   "waiting until child is done.");
-	    (void)waitpid(pid, NULL, 0);
+	    default:
+		if (handover_lock(pid)) {
+		    /* could not hand over lock file to child, so wait until it
+		       dies */
+		    syslog(LOG_NOTICE, "could not hand over lockfile to child: %m, "
+			    "waiting until child is done.");
+		    (void)waitpid(pid, NULL, 0);
+		}
+		break;
 	}
-	break;
     }
 
     exit(rc);



-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list