Compare commits

...
5 Commits
Author SHA1 Message Date
Joachim Nilsson a18c5f3441 Update ChangeLog and bump version for release.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-10-08 12:05:21 +02:00
Joachim Nilsson 03c47a4020 Only cls() when verbose mode enabled, maybe we should remove it?
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-10-08 11:59:56 +02:00
Joachim Nilsson 77b0df3d07 Bugfix: Do not free() static string in new runparts directive
This is a bugfix to 785c21d, which introduced the new runparts
directive in finit.conf

- Do not attempt to free() a static string, use same approach as
  username and hostname.

- Do not overwrite hostname, set the correct variable if runparts
  directive is found in finit.conf

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-10-08 11:42:19 +02:00
Joachim Nilsson 7e3465a022 Clear recorded PID of lost service.
Many callbacks check their svc->pid to determine SVC_RELOAD or SVC_START,
they rely on it to be updated.  When a service is lost we must therefore
clear its recorded PID before asking the callback what to do.

Also, swap comparison in debug code for dumping service arguments ...

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-10-07 02:00:16 +02:00
Joachim Nilsson 04fd3f7a1b Add __FILE__ to _d() debug to see finit:plugin.c:enabled() ...
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-10-06 21:32:26 +02:00
7 changed files with 20 additions and 7 deletions
+9
View File
@@ -1,3 +1,12 @@
1.7 (20121008)
- Show __FILE__ in _d() debug messages, useful for plugins with
similarily named callbacks. Also, only in debug mode anyway
- Make sure to cleanup recorded PID when a service is lost.
Required by service plugins for their callbacks to work.
- Bugfix: Do not free() static string in finit.conf parser
- Only clear screen when in verbose mode. Maybe this should
be removed altogether?
1.6 (20121006) 1.6 (20121006)
- Skip . and .. in plugin loader and display error on failed plugins - Skip . and .. in plugin loader and display error on failed plugins
- Support for overriding /etc/finit.d with "runparts DIR" in finit.conf - Support for overriding /etc/finit.d with "runparts DIR" in finit.conf
+1 -1
View File
@@ -29,7 +29,7 @@
ROOTDIR = $(shell pwd) ROOTDIR = $(shell pwd)
#VERSION ?= $(shell git tag -l | tail -1) #VERSION ?= $(shell git tag -l | tail -1)
VERSION ?= 1.6 VERSION ?= 1.7
NAME = finit NAME = finit
PKG = $(NAME)-$(VERSION) PKG = $(NAME)-$(VERSION)
DEV = $(NAME)-dev DEV = $(NAME)-dev
+2 -2
View File
@@ -64,9 +64,9 @@ void parse_finit_conf(char *file)
char line[LINE_SIZE]; char line[LINE_SIZE];
char cmd[CMD_SIZE]; char cmd[CMD_SIZE];
/* Default username and hostname */
username = strdup(DEFUSER); username = strdup(DEFUSER);
hostname = strdup(DEFHOST); hostname = strdup(DEFHOST);
rcsd = strdup(FINIT_RCSD);
if ((fp = fopen(file, "r")) != NULL) { if ((fp = fopen(file, "r")) != NULL) {
char *x; char *x;
@@ -124,7 +124,7 @@ void parse_finit_conf(char *file)
} }
if (MATCH_CMD(line, "runparts ", x)) { if (MATCH_CMD(line, "runparts ", x)) {
if (rcsd) free(rcsd); if (rcsd) free(rcsd);
hostname = build_cmd(NULL, x, CMD_SIZE); rcsd = build_cmd(NULL, x, CMD_SIZE);
continue; continue;
} }
if (MATCH_CMD(line, "startx ", x)) { if (MATCH_CMD(line, "startx ", x)) {
+1 -1
View File
@@ -41,7 +41,7 @@ char *sdown = NULL;
char *network = NULL; char *network = NULL;
char *username = NULL; char *username = NULL;
char *hostname = NULL; char *hostname = NULL;
char *rcsd = FINIT_RCSD; char *rcsd = NULL;
static void parse_kernel_cmdline(void) static void parse_kernel_cmdline(void)
+1 -1
View File
@@ -653,7 +653,7 @@ void cls(void)
{ {
static const char cls[] = "\e[2J\e[1;1H"; static const char cls[] = "\e[2J\e[1;1H";
if (!debug) if (verbose)
fprintf (stderr, "%s", cls); fprintf (stderr, "%s", cls);
} }
+1 -1
View File
@@ -58,7 +58,7 @@
#endif #endif
#define echo(fmt, args...) do { if (verbose) { fprintf(stderr, fmt "\n", ##args); } } while (0) #define echo(fmt, args...) do { if (verbose) { fprintf(stderr, fmt "\n", ##args); } } while (0)
#define _d(fmt, args...) do { if (debug) { fprintf(stderr, "finit:%s() - " fmt "\n", __func__, ##args); } } while (0) #define _d(fmt, args...) do { if (debug) { fprintf(stderr, "finit:%s:%s() - " fmt "\n", __FILE__, __func__, ##args); } } while (0)
#define _e(fmt, args...) do { fprintf(stderr, "finit:%s:%s() - " fmt "\n", __FILE__, __func__, ##args); } while (0) #define _e(fmt, args...) do { fprintf(stderr, "finit:%s:%s() - " fmt "\n", __FILE__, __func__, ##args); } while (0)
#define _pe(fmt, args...) do { fprintf(stderr, "finit:%s:%s() - " fmt ". Error %d: %s\n", __FILE__, __func__, ##args, errno, strerror(errno)); } while (0) #define _pe(fmt, args...) do { fprintf(stderr, "finit:%s:%s() - " fmt ". Error %d: %s\n", __FILE__, __func__, ##args, errno, strerror(errno)); } while (0)
+5 -1
View File
@@ -248,6 +248,10 @@ void svc_monitor(void)
continue; continue;
_d("Ouch, lost pid %d - %s(%d)", lost, name, svc->pid); _d("Ouch, lost pid %d - %s(%d)", lost, name, svc->pid);
/* No longer running, update books. */
svc->pid = 0;
if (sig_stopped()) { if (sig_stopped()) {
_e("Stopped, not respawning killed processes."); _e("Stopped, not respawning killed processes.");
break; break;
@@ -337,7 +341,7 @@ int svc_start(svc_t *svc)
char arg[MAX_ARG_LEN]; char arg[MAX_ARG_LEN];
snprintf(arg, sizeof(arg), "%s ", args[i]); snprintf(arg, sizeof(arg), "%s ", args[i]);
if ((sizeof(buf) - strlen(buf)) < strlen(arg)) if (strlen(arg) < (sizeof(buf) - strlen(buf)))
strcat(buf, arg); strcat(buf, arg);
} }
_e("%starting %s: %s", respawn ? "Res" : "S", svc->cmd, buf); _e("%starting %s: %s", respawn ? "Res" : "S", svc->cmd, buf);