More and better error loging during daemon startup

Wed, 05 May 2021 20:32:07 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 05 May 2021 20:32:07 +0200
changeset 745
3addb8cfcc3e
parent 744
b8ccc85675a0
child 746
44d929ff268e

More and better error loging during daemon startup

bmsd/bms.c file | annotate | diff | comparison | revisions
bmsd/futil.c file | annotate | diff | comparison | revisions
bmsd/lock.c file | annotate | diff | comparison | revisions
--- a/bmsd/bms.c	Wed May 05 20:31:26 2021 +0200
+++ b/bmsd/bms.c	Wed May 05 20:32:07 2021 +0200
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (C) 2017-2020
+ * Copyright (C) 2017-2021
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -109,14 +109,14 @@
     tmppath = xstrcpy(Config.web_root);
     tmppath = xstrcat(tmppath, (char *)"/log/fermentation/");
     if (! mkdirs(tmppath, 0755)) {
-	rc = 5;
+	rc = 6;
 	goto endit1;
     }
     free(tmppath);
     tmppath = xstrcpy(Config.web_root);
     tmppath = xstrcat(tmppath, (char *)"/log/brews/");
     if (! mkdirs(tmppath, 0755)) {
-	rc = 5;
+	rc = 7;
 	goto endit1;
     }
     free(tmppath);
--- a/bmsd/futil.c	Wed May 05 20:31:26 2021 +0200
+++ b/bmsd/futil.c	Wed May 05 20:32:07 2021 +0200
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (C) 2017
+ * Copyright (C) 2017-2021
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -52,7 +52,7 @@
     if ((last == 0) || (last == EEXIST)) {
 	return TRUE;
     } else {
-	syslog(LOG_NOTICE, "mkdirs(%s)", name);
+	syslog(LOG_NOTICE, "mkdirs(%s): %s", name, strerror(last));
 	return FALSE;
     }
 }
--- a/bmsd/lock.c	Wed May 05 20:31:26 2021 +0200
+++ b/bmsd/lock.c	Wed May 05 20:32:07 2021 +0200
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (C) 2017-2020
+ * Copyright (C) 2017-2021
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -84,7 +84,7 @@
 	fclose(fp);
 	if (kill(oldpid,0) == -1) {
 	    if (errno == ESRCH || errno == EPERM) {
-		syslog(LOG_NOTICE, "Stale lock found for pid %u", oldpid);
+		syslog(LOG_NOTICE, "Stale lock found for pid %u, try lock again", oldpid);
 		unlink(lockfile);
 		/* no return, try lock again */  
 	    } else {

mercurial