Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 531600 | Differences between
and this patch

Collapse All | Expand All

(-)a/src/librc/librc-daemon.c (-11 / +11 lines)
Lines 500-505 rc_service_daemons_crashed(const char *service) Link Here
500
	char *exec = NULL;
500
	char *exec = NULL;
501
	char *name = NULL;
501
	char *name = NULL;
502
	char *pidfile = NULL;
502
	char *pidfile = NULL;
503
	char *ch_root = NULL;
504
	char *spidfile = NULL;
503
	pid_t pid = 0;
505
	pid_t pid = 0;
504
	RC_PIDLIST *pids;
506
	RC_PIDLIST *pids;
505
	RC_PID *p1;
507
	RC_PID *p1;
Lines 554-581 rc_service_daemons_crashed(const char *service) Link Here
554
		}
556
		}
555
		fclose(fp);
557
		fclose(fp);
556
558
557
		char *ch_root = rc_service_value_get(basename_c(service), "chroot");
559
		ch_root = rc_service_value_get(basename_c(service), "chroot");
558
		char *spidfile = pidfile;
559
		if (ch_root && pidfile) {
560
		if (ch_root && pidfile) {
560
			spidfile = xmalloc(strlen(ch_root) + strlen(pidfile) + 1);
561
			spidfile = xmalloc(strlen(ch_root) + strlen(pidfile) + 1);
561
			strcpy(spidfile, ch_root);
562
			strcpy(spidfile, ch_root);
562
			strcat(spidfile, pidfile);
563
			strcat(spidfile, pidfile);
564
			pidfile = xrealloc(pidfile, strlen(spidfile) + 1);
565
			strcpy(pidfile, spidfile);
566
			free(spidfile);
567
			spidfile = NULL;
563
		}
568
		}
564
569
565
		pid = 0;
570
		pid = 0;
566
		if (spidfile) {
571
		if (pidfile) {
567
			retval = true;
572
			retval = true;
568
			if ((fp = fopen(spidfile, "r"))) {
573
			if ((fp = fopen(pidfile, "r"))) {
569
				if (fscanf(fp, "%d", &pid) == 1)
574
				if (fscanf(fp, "%d", &pid) == 1)
570
					retval = false;
575
					retval = false;
571
				fclose(fp);
576
				fclose(fp);
572
			}
577
			}
573
			free(spidfile);
578
			free(pidfile);
574
			spidfile = NULL;
579
			pidfile = NULL;
575
			if (ch_root) {
576
				free(pidfile);
577
				pidfile = NULL;
578
			}
579
580
580
			/* We have the pid, so no need to match
581
			/* We have the pid, so no need to match
581
			   on exec or name */
582
			   on exec or name */
582
- 

Return to bug 531600